Submission #221994

#TimeUsernameProblemLanguageResultExecution timeMemory
221994Mamnoon_SiamTeams (IOI15_teams)C++11
0 / 100
4090 ms15632 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; using vi = vector<int>; using ll = long long; using ii = pair<int, int>; const int maxn = 2e5 + 5; int A[maxn], B[maxn], N; void init(int _N, int _A[], int _B[]) { N = _N; for(int i = 0; i < N; i++) A[i] = _A[i], B[i] = _B[i]; } int count(int l, int r) { int ret = 0; for(int i = 0; i < N; ++i) { ret += B[i] < l or A[i] > r; } return N - ret; } int can(int M, int K[]) { for(ll i = 0, s = 0; i < M; ++i) { if((s += K[i]) > N) return 0; } map<int, int> cnt; for(int i = 0; i < M; ++i) { cnt[K[i]] += K[i]; } vector<ii> v; for(auto x : cnt) { v.emplace_back(x.first, x.second); } for(int i = 0; i < (int)v.size(); ++i) { int s = 0; for(int j = i; j < (int)v.size(); ++j) { s += v[j].second; if(count(v[i].first, v[j].first) < s) { return 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...