// CERC 2012 // Problem G: Jewel heist // Slow solution (checking every cap point), O(n^2) // Author: Lech Duraj #include #include using namespace std; const int maxn = 200*1000; struct jewel { int x, y, c; }; jewel A[maxn]; int L[maxn+1]; bool cmpx(jewel a, jewel b) { return a.x=A[i].y) continue; if (A[j].c==A[i].c) { cl = 0; last = A[j].x; } if (A[j].c!=A[i].c && A[j].x>last) cl++; } int cr = 0; last = A[n-1].x+1; for(int j=n-1; j>i; j--) { if (A[j].y>=A[i].y) continue; if (A[j].c==A[i].c) { cr = 0; last = A[j].x; } if (A[j].c!=A[i].c && A[j].x