Submission #126063

#TimeUsernameProblemLanguageResultExecution timeMemory
126063dragonslayeritTeams (IOI15_teams)C++14
0 / 100
4103 ms50336 KiB
#include "teams.h" #include <vector> #include <set> std::vector<int> right[500005]; int NN; void init(int N, int A[], int B[]) { NN=N; for(int i=0;i<N;i++){ right[A[i]].push_back(B[i]); } } int can(int M, int K[]) { std::vector<int> freq(NN+1); int sum=0; for(int i=0;i<M;i++){ freq[K[i]]+=K[i]; sum+=K[i]; if(sum>NN) return 0; } std::multiset<int> active; for(int i=1;i<=NN;i++){ for(int v:right[i]){ active.insert(v); } while(freq[i]--){ if(active.empty()) return 0; active.erase(active.begin()); } } 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...