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 <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << endl;
const int MAXN = 1e6 + 10;
int n, F[MAXN];
vector<int> L[MAXN];
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; i++)
L[A[i]].push_back(B[i]);
}
int can(int M, int K[]) {
for (int i = 0; i < MAXN; i++)
F[i] = 0;
int m = M;
for (int i = 0; i < m; i++)
F[K[i]]++;
priority_queue<int, vector<int>, greater<int>> pq;
for (int l = 0; l <= n; l++) {
while (!pq.empty() && pq.top() < l) pq.pop();
for (int r : L[l]) {
pq.push(r);
}
while (F[l]--) {
int x = l;
while (x--) {
if (pq.empty()) return 0;
pq.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... |