Submission #201332

#TimeUsernameProblemLanguageResultExecution timeMemory
201332tinjyuTeams (IOI15_teams)C++14
34 / 100
4099 ms28116 KiB
#include "teams.h" #include <iostream> #include <algorithm> #include <vector> using namespace std; struct node{ long long int a,b; }val[1000005]; long long int n,m,k[1000004]; bool cmp1(node x,node y) { return x.a < y.a; } bool cmp2(int x,int y) { return x<y; } struct cmp3 { bool operator()(node x,node y) { return x.b>y.b; } }; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++) { val[i].a=A[i]; val[i].b=B[i]; } sort(val,val+n,cmp1); } int can(int M, int K[]) { m=M; for(int i=0;i<m;i++)k[i]=K[i]; sort(k,k+m,cmp2); vector<node> v; int p=0; for(int i=0;i<m;i++) { while(val[p].a<=k[i] && p<n) { v.push_back(val[p]); push_heap(v.begin(),v.end(),cmp3()); p++; } while(v[0].b<k[i] && v.empty()==false){ pop_heap(v.begin(),v.end(),cmp3()); v.pop_back(); } while(k[i]--) { if(v.empty()==true) { return 0; } pop_heap(v.begin(),v.end(),cmp3()); v.pop_back(); } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...