Submission #590127

#TimeUsernameProblemLanguageResultExecution timeMemory
590127yutabiTeams (IOI15_teams)C++14
34 / 100
4066 ms13044 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define pb push_back typedef pair <int,int> ii; int n; int* a; int* b; void init(int N, int A[], int B[]) { n=N; a=A; b=B; } int can(int M, int K[]) { sort(K,K+M); vector <ii> s; for(int i=0;i<n;i++) { s.pb(ii(a[i],b[i])); } sort(s.begin(),s.end()); int ptr=0; priority_queue <int> pq; bool flag=0; for(int i=0;i<M;i++) { while(ptr<n && s[ptr].first<=K[i]) { pq.push(-s[ptr].second); ptr++; } while(pq.size() && -pq.top()<K[i]) { pq.pop(); } for(int j=0;j<K[i];j++) { if(pq.empty()) { flag=1; break; } pq.pop(); } if(flag) { break; } } if(flag) { return 0; } 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...