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;
/*
g++ teams.cpp grader.cpp teams.h
./a.out
*/
const int N = 5e5 + 69;
int n, a[N], b[N], ord[N];
void init(int _n, int _a[], int _b[]) {
n = _n;
for (int i = 0;i < n;i++) {
a[i] = _a[i];
b[i] = _b[i];
ord[i] = i;
}
sort(ord, ord + n, [&](int i, int j) {
return b[i] < b[j];
});
}
int can(int m, int k[]) {
int ptr = 0;
sort(k, k + m);
for (int i = 0;i < m;i++) {
int s = 0;
while (s < k[i] && ptr < n) {
int j = ord[ptr];
if (a[j] <= k[i] && b[j] >= k[i])
s += 1;
ptr += 1;
}
if (s < k[i])
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... |