Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- struct point {
- int x, y, t;
- point () {}
- point (int Y, int X, int T) : y ( Y), x (X), t (T) {}
- friend bool operator < (const point &a, const point &b) {
- if (a.y != b.y) return a.y < b.y;
- if (a.x != b.x) return a.x < b.x;
- return a.t < b.t;
- }
- };
- point d[200002];
- int main(){
- int i, n, y, xa, xb, t = 0, best = 0;
- scanf("%d",&n);
- for( i = 0; i < n; i++){
- scanf("%d%d%d",&y, &xa, &xb);
- d [ i * 2 ] = point (y, xa, 0);
- d [ i * 2 + 1 ] = point(y, xb, 1);
- }
- n = n * 2;
- sort(d, d + n);
- for( i = 0; i < n; i++){
- if ( d [ i ].t == 0) t++; else t--;
- if(t > best) best = t;
- }
- if (best == 0) best++;
- printf("%d\n",best);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment