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 nums[100005];
int nume[100005];
int nr;
void init(int n, int a[], int b[]) {
nr=n;
for(int i = 0;i<100005;i++){
nums[i]=0;
nume[i]=0;
}
for(int i = 0;i<n;i++){
nums[a[i]]++;
nume[b[i]]++;
}
}
int can(int m, int k[]) {
int active=0;
int knum[100005];
fill(knum,knum+100005,0);
long long sm = 0;
for(int i = 0;i<m;i++){
knum[k[i]]++;
sm+=k[i];
}
if(sm>nr){
return 0;
}
int skip=0;
for(int i = 0;i<100005;i++){
active+=nums[i];
active-=knum[i]*i;
if(active<0){
return 0;
}
skip+=knum[i]*i;
if(skip>=nume[i]){
skip-=nume[i];
}
else{
active-=(nume[i]-skip);
skip=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... |