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<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
int n;
int a[500000];
int b[500000];
void init(int N,int A[],int B[]){
n=N;
vector<pair<int,int>>vec(n);
for(int i=0;i<n;i++)
vec[i]={A[i],B[i]};
sort(vec.begin(),vec.end());
for(int i=0;i<n;i++){
a[i]=vec[i].first;
b[i]=vec[i].second;
}
}
int can(int m,int k[]){
multiset<int>s;
sort(k,k+m);
int ci=0;
for(int i=0;i<m;i++){
while(ci<n&&a[ci]<=k[i])
s.insert(b[ci++]);
while(s.size()&&*s.begin()<k[i])
s.erase(s.begin());
for(int j=0;j<k[i];j++){
if(s.empty())
return 0;
s.erase(s.begin());
}
}
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... |