Submission #1107054

#TimeUsernameProblemLanguageResultExecution timeMemory
1107054AvianshTeams (IOI15_teams)C++17
0 / 100
4062 ms10004 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...