Submission #140201

#TimeUsernameProblemLanguageResultExecution timeMemory
140201SirCenessTeams (IOI15_teams)C++14
0 / 100
4093 ms9052 KiB
#include "teams.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define inside sl<=l&&r<=sr #define outside r<sl||sr<l #define orta ((l+r)>>1) #define INF 1000000009 #define mod 1000000007 #define ppair(x); cerr << "(" << x.first << ", " << x.second << ")\n"; #define bas(x) #x << ": " << x << " " #define prarr(x, n); cerr << #x << ": "; for(int qsd = 0; qsd < n; qsd++) cerr << x[qsd] << " "; cerr << "\n"; #define prarrv(x); cerr << #x << ": "; for(int qsd = 0; qsd < (int)x.size(); qsd++) cerr << x[qsd] << " "; cerr << "\n"; using namespace std; typedef long long ll; int n; vector<int> artir; vector<int> azalt; void init(int N, int A[], int B[]){ n = N; artir.resize(n+1); azalt.resize(n+1); for (int i = 0; i <= n; i++) artir[i] = azalt[i] = 0; for (int i = 0; i < n; i++){ artir[A[i]]++; azalt[B[i]]++; } } int can(int M, int K[]){ ll cur = 0; ll aldim = 0; int ki = 0; sort(K, K+M); for (int i = 1; i <= n; i++){ cur += artir[i]; while (ki != M && K[ki] == i){ if (cur < K[ki]) return 0; cur -= K[ki]; aldim += K[ki]; ki++; } if (aldim >= azalt[i]) aldim -= azalt[i]; else { cur -= azalt[i] - aldim; aldim = 0; } } return (aldim == 0 && ki == M); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...