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;
#define maxn 100005
int n;
pair<int,int> p[maxn];
priority_queue<int> heap;
void init(int N, int A[], int B[]) {
n = N;
for(int i=0;i<n;i++) p[i] = {A[i], B[i]};
sort(&p[0],&p[n]);
}
int can(int M, int K[]) {
int i,j,sz;
while(!heap.empty()) heap.pop();
sort(&K[0],&K[M]);
for(i=0,j=0;i<M;i++) {
while(j<n && p[j].first<=K[i]) heap.push(-p[j++].second);
while(!heap.empty() && -heap.top()<K[i]) heap.pop();
for(sz=0;sz<K[i];sz++) {
if(heap.empty()) return 0;
heap.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... |