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;
typedef pair<int,int> ii;
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
vector<ii> v;
void init(int N,int A[],int B[]){
for(int i=0;i<N;++i){
v.pb({A[i],B[i]});
}
sort(all(v));
}
int can(int M,int K[]){
priority_queue<int,vector<int>,greater<int>> pq;
sort(K,K+M);
int ptr=0,n=sz(v);
for(int i=0;i<M;++i){
while(ptr<n&&v[ptr].fi<=K[i]){
pq.push(v[ptr++].se);
}
while(!pq.empty()&&pq.top()<K[i])pq.pop();
if(sz(pq)<K[i])return 0;
for(int j=0;j<K[i];++j)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... |