이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |