This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// moreflags=grader.cpp
//
// 10
#include "teams.h"
#include<vector>
#include<queue>
#include<functional>
#include<algorithm>
std::vector<std::pair<int, int>> students;
void init(int N, int A[], int B[]) {
students.clear(); students.reserve(N);
for(int i=0; i<N; ++i)
students.push_back({A[i], B[i]});
std::sort(begin(students), end(students));
}
int can(int M, int K[]) {
std::priority_queue<int, std::vector<int>, std::greater<int>> rights;
auto iterator=students.begin();
for(int index=0; index<M; ++index){
auto const k=K[index];
while(iterator!=students.end() and iterator->first<=k){
rights.push(iterator->second);
++iterator;
}
while(not rights.empty() and rights.top()<k)
rights.pop();
for(int _=0; _<k; ++_){
if(rights.empty())
return 0;
rights.pop();
}
}
return 1;
}
# | 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... |