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 pb push_back
pair<int,int> v[100000]; int n;
multiset<int> S;
void init(int N, int a[], int b[]) {
for(int i = 0; i < N; i++)
v[i]=make_pair(a[i],b[i]);
n = N; sort(v,v+n,[&](pair<int,int> x, pair<int,int>y){
return x.second > y.second;
});
}
int can(int m, int a[]) {
sort(a,a+m); reverse(a,a+m);
int j = 0; S.clear();
for(int i = 0; i < m; i++){
int x = a[i];
while(j<n and v[j].second>=a[i])
S.insert(v[j].first), j++;
while(x--){
auto itr = S.upper_bound(a[i]);
if(itr==begin(S)) return 0;
S.erase(--itr);
}
}
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... |