Submission #1107053

#TimeUsernameProblemLanguageResultExecution timeMemory
1107053AvianshTeams (IOI15_teams)C++17
0 / 100
4072 ms16712 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; int nums[100005]; int nume[100005]; void init(int n, int a[], int b[]) { 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); for(int i = 0;i<m;i++){ knum[k[i]]++; } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...