Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- #define dim 1000
- using namespace std;
- ifstream fin("cursuri.in");
- ofstream fout("cursuri.out");
- struct curs
- {
- int start,stop;
- }v[dim+5],crt;
- int cer,n,k;
- void citire()
- {
- fin>>c>>n>>k;
- for(int i=1;i<=n;i++)
- fin>>v[i].start>>v[i].stop;
- }
- bool comp(curs a,curs b)
- {
- return a.stop<b.stop;
- }
- void greedy()
- {
- int cate=0;
- curs s[dim+5];
- if(c==1)
- {
- for(int i=1;i<=k;i++)
- s[i].start=s[i].stop=0;
- for(int i=1;i<=n;i++)
- {
- int p=0;
- for(int j=1;j<=k;j++)
- if(v[i].start>=s[j].stop)
- p=j;
- if(p)
- s[p]=v[i],cate++;
- }
- }
- }
- int main()
- {
- citire();
- sort(v+1,v+n+1,comp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement