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;
int a[100000];
int b[100000];
typedef pair<int,int> P;
P ind[100000];
int k[100000];
int m;
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++) {
a[i]=A[i];
b[i]=B[i];
ind[i]=P(a[i],i);
}
sort(ind,ind+n);
}
int can(int M, int K[]) {
m=M;
for(int i=0;i<m;i++) {
k[i]=K[i];
}
sort(k,k+m);
int in=0;
priority_queue<int,vector<int>,greater<int>> pq;
for(int i=0;i<m;i++) {
while (in<n&&ind[in].first<=k[i]) {
pq.push(b[ind[in].second]);
in++;
}
for(int j=0;j<k[i];j++) {
while (!pq.empty()&&pq.top()<k[i]) {
pq.pop();
}
if (pq.empty()) {
return 0;
}
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... |