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 <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()
int n;
vector<pair<int, int>> g;
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; i++) {
g.push_back({A[i], B[i]});
}
sort(all(g));
}
bool can(int M, int K[]) {
sort(K, K + M);
priority_queue<int> pq;
for (int i = 0, j = 0; i < M; i++) {
while (j < n && g[j].first <= K[i]) {
pq.push(-g[j++].second);
}
while (pq.size() > 0 && -pq.top() < K[i]) {
pq.pop();
}
while (K[i]--) {
if (pq.size() == 0) return 0;
pq.pop();
}
}
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... |