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;
const int S = 2e5+10;
pair<int,int>p[S];
int n;
void init(int N, int A[], int B[]) {
n = N;
for(int i=1;i<=N;i++)
p[i] = {A[i-1],B[i-1]};
sort(p+1,p+n+1);
}
int can(int M, int K[]) {
sort(K,K+M);
int cur = 1;
multiset<int>st;
for(int i=0;i<M;i++){
while(cur<=n)
if(p[cur].first<=K[i])
st.insert(p[cur++].second);
else
break;
while(!st.empty()){
auto it = st.begin();
if(*it<K[i])
st.erase(*it);
else
break;
}
int cnt = 0;
while(!st.empty()){
if(cnt==K[i])
break;
auto it = st.lower_bound(K[i]);
if(it==st.end())
break;
st.erase(st.find(*it));
cnt++;
}
if(cnt!=K[i])
return 0;
}
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... |