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 fi first
#define se second
typedef pair<int,int> pii;
const int MN = 500005;
int N;
pii A[MN];
void init(int n, int a[], int b[]) {
N = n;
for (int i=0; i<N; ++i) {
A[i] = pii(a[i], b[i]);
}
sort(A, A+N);
}
int can(int M, int K[]) {
sort(K, K+M);
int idx = 0;
priority_queue<pii, vector<pii>, greater<pii>> pq;
for (int i=0; i<M; ++i) {
while (idx < N && A[idx].fi <= K[i]) {
pq.push(A[idx]);
++idx;
}
int rem = K[i];
while (rem > 0 && pq.size() > 0) {
if (pq.top().fi <= K[i] && K[i] <= pq.top().se) --rem;
pq.pop();
}
if (rem > 0) return 0;
}
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... |