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;
int n;
vector<int> a, b;
vector<array<int, 2>> v;
int can(int M, int K[]) {
sort(K, K + M);
map<int, int> frq;
for (int j = 0, i = 0; j < M; ++j) {
for (; i < n && v[i][0] <= K[j]; ++i) ++frq[v[i][1]];
auto it = frq.lower_bound(K[j]);
while (it != frq.end() && K[j]) {
if (it->second <= K[j]) {
K[j] -= it->second;
it->second = 0;
} else {
K[j] = 0;
it->second -= K[j];
}
++it;
}
// cerr << K[j] << endl;
if (K[j]) return 0;
}
return 1;
}
void init(int N, int A[], int B[]) {
n = N;
a.resize(n);
b.resize(n);
v.resize(n);
for (int i = 0; i < n; ++i) {
a[i] = A[i];
b[i] = B[i];
v[i] = {a[i], b[i]};
}
sort(v.begin(), v.end());
}
# | 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... |