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;
int n,*a,*b;
int p[200000];
void init(int N, int A[], int B[]) {
n=N,a=A,b=B;
for(int i=0;i<n;i++){
p[i]=i;
}
sort(p,p+n,[&](int i,int j)->bool {
return a[i]<a[j];
});
}
int can(int M, int K[]) {
priority_queue<int,vector<int>,greater<int>>pq;
int j=0;
for(int i=0;i<M;i++){
while(j<n&&a[p[j]]<=K[i]){
pq.push(b[p[j]]);
j++;
}
while(pq.size()&&pq.top()<K[i])pq.pop();
while(K[i]&&pq.size()){
K[i]--;
pq.pop();
}
if(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... |