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 int int64_t
int n;
vector<pair<int, int>> ranges;
void init(signed _N, signed A[], signed B[]) {
n = _N;
ranges.resize(n);
for (int i = 0; i<n; i++) {
ranges[i].first = A[i];
ranges[i].second = B[i];
}
sort(ranges.begin(), ranges.end());
}
signed can(signed m, signed K[]) {
vector<int> k(m);
for (int i = 0; i < m; i++) k[i] = K[i];
sort(k.begin(), k.end());
multiset<int> active;
int point = 0;
for (int i = 0; i<m; i++) {
while (point < (int)ranges.size() && ranges[point].first <= k[i]) {
active.insert(ranges[point].second);
point++;
}
while(active.size() && *active.begin() < k[i]) {
active.erase(active.begin());
}
for (int j = 0; j<k[i]; j++) {
if (active.empty()) return 0;
active.erase(active.begin());
}
}
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... |