Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- pair<int,int> posts[16000+50];
- #define start first
- #define end second
- int main()
- {
- int n;
- scanf("%d",&n);
- for(int i=0;i<n;++i)
- scanf("%d%d",&(posts[i].start),&(posts[i].end));
- sort(posts,posts+n);
- int red=0;
- int max_seen=0;
- for(int i=0;i<n;++i)
- {
- if(max_seen>posts[i].end)
- red++;
- max_seen=max(max_seen,posts[i].end);
- }
- printf("%d\n",red);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement