# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301859 | square1001 | Teams (IOI15_teams) | C++14 | 4100 ms | 36928 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 <queue>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int N; vector<int> A, B; vector<vector<int> > G;
void init(int N_, int A_[], int B_[]) {
N = N_;
A = vector<int>(A_, A_ + N);
B = vector<int>(B_, B_ + N);
sort(A.begin(), A.end());
sort(B.begin(), B.end());
G = vector<vector<int> >(N + 1);
for(int i = 0; i < N; ++i) {
G[A[i]].push_back(B[i]);
}
}
int can(int M, int K[]) {
sort(K, K + M);
int ptr = 0;
priority_queue<int, vector<int>, greater<int> > que;
for(int i = 0; i < M; ++i) {
while(ptr <= K[i]) {
for(int j : G[ptr]) {
que.push(j);
}
++ptr;
}
while(!que.empty() && que.top() < K[i]) {
que.pop();
}
if(que.size() < K[i]) {
return 0;
}
for(int j = 0; j < K[i]; ++j) {
que.pop();
}
}
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... |