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 "teams.h"
#include<bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
vector<P> v;
int n;
void init(int N, int A[], int B[]) {
for(int i=0;i<N;i++){
v.emplace_back(A[i],B[i]);
}
n=N;
sort(v.begin(),v.end());
}
int can(int M, int K[]) {
sort(K,K+M);
int id=0;
priority_queue<P,vector<P>,greater<P>> q;
for(int i=0;i<M;i++){
while(id<n&&v[id].first<=K[i]){
q.push(P(v[id].second,v[id].first));
id++;
}
int cnt=K[i];
while(!q.empty()&&cnt>0){
if(q.top().first<K[i]){
q.pop();
continue;
}
cnt--;
q.pop();
}
if(cnt>0){
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... |