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>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define C make_pair
#define vec vector
#define ins push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
int n;
multiset<ii> avail;
void init(int N, int A[], int B[]) {
n = N;
for(int i=0; i<n; ++i) avail.insert({A[i], B[i]});
}
bool can(int M, int K[]) {
sort(K, K+M);
for(int i=0; i<M; ++i) {
vec<ii> cands;
for(auto x : avail) if (x.fi <= K[i] && x.se >= K[i])
cands.emplace_back(x.se, x.fi);
if (K[i] > sz(cands)) return 0;
sort(all(cands));
for(int j=0; j<K[i]; ++j) avail.erase(avail.find({cands[j].se, cands[j].fi}));
}
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... |