Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- using namespace std;
- ifstream in("cursuri.in");
- ofstream out("cursuri.out");
- pair <int,int> v[1001];
- int t[1001];
- int main()
- {
- int n,i,p,k,j;
- in>>p>>n>>k;
- for(i=1;i<=n;i++)
- in>>v[i].second>>v[i].first;
- sort(v+1,v+n+1);
- for(i=1;i<=n;i++)
- swap(v[i].first,v[i].second);
- int cnt=0;
- for(i=1;i<=n;i++)
- {
- int max1=0;
- for(j=1;j<=k;j++)
- if(t[j]<=v[i].first&&t[j]>max1)
- max1=t[j];
- for(j=1;j<=k;j++)
- if(t[j]<=v[i].first&&t[j]==max1)
- {
- cnt++;
- t[j]=v[i].second;
- break;
- }
- }
- if(p==1)
- out<<cnt;
- else
- {
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement