Submission #126062

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

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:8:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(int N, int A[], int B[]) {
                                  ^
teams.cpp:6:5: note: shadowed declaration is here
 int N;
     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...