# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126062 | dragonslayerit | Teams (IOI15_teams) | C++14 | 4041 ms | 57204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |