// Diamonds Solution // Author: Kent Jones, Whitworth University // Description: Same dp algorithm as the trap clearing algorithm. // #include #include #include using namespace std; // Compare two diamonds bool operator<(const pair & a, const pair & b) { if ( (a.first < b.first) && (a.second > b.second) ) return true; return false; } int main() { int n, cases, lmax; double carats, clarity; cin >> cases; while (cases --> 0) { vector< pair > dp; // diamond pile vector< int > dpt; // dp table cin >> n; lmax = 0; dpt.resize(n,1); for (int i = 0; i> carats >> clarity; dp.push_back(make_pair(carats, clarity)); } // For each diamond, find longest chain ending on that diamond for ( int i=0; i