# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163586 | shenxy | Teams (IOI15_teams) | C++11 | 4024 ms | 16760 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 <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> ii;
int n;
ii res[100000];
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < N; ++i) res[i] = ii(A[i], B[i]);
sort(res, res + N);
}
int can(int M, int K[]) {
priority_queue<int> pq;
sort(K, K + M);
int ptr = 0;
for (int i = 0; i < M; ++i) {
while (ptr != n && res[ptr].first <= K[i]) pq.push(-res[ptr++].second);
while (!pq.empty() && -pq.top() < K[i]) pq.pop();
if (pq.size() < K[i]) return 0;
for (int j = 0; j < K[i]; ++j) pq.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... |