1 solutions
-
1
#include<bits/stdc++.h> using namespace std; struct _ { int Begin,End; }a[2000]; bool __(_ a,_ b) { return a.End<b.End ; } int main() { int b; cin>>b; for(int i=0;i<b;i++)cin>>a[i].Begin>>a[i].End; sort(a,a+b,__); int last=a[0].End,s=1; for(int i=0;i<b;i++)if(a[i].Begin>=last) { s++; last=a[i].End ; } cout<<s; }
- 1
Information
- ID
- 1785
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 15
- Accepted
- 9
- Uploaded By