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 "bits/stdc++.h"
#include "teams.h"
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
vector<array<int,2>> v;
int n;
void init(int N, int A[], int B[]){
n = N;
for(int i = 0 ; i < n ; i++) v.push_back({A[i], B[i]});
sort(all(v));
}
int can(int M, int K[]){
sort(K,K+M);
multiset<int> ms;
int p = 0;
for(int i = 0 ; i < M ; i++){
int val = K[i];
while(p < n && v[p][0] <= val) ms.insert(v[p++][1]);
while(!ms.empty() && val){
auto it = ms.lower_bound(K[i]);
if(it == ms.end()) break;
val--;
ms.erase(ms.find(*it));
}
if(val) 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... |