Submission #869939

#TimeUsernameProblemLanguageResultExecution timeMemory
869939MatjazTeams (CEOI11_tea)C++14
0 / 100
292 ms15080 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N; cin >> N; vector<int> a(N); for (int i=0;i<N;i++) cin >> a[i]; sort(a.begin(), a.end()); vector<int> max_teams(N); if (a[0] == 1) max_teams[0] = 1; else max_teams[0] = 0; for (int i=1;i<N;i++){ max_teams[i] = max_teams[i-1]; if (i + 1 - a[i] == 0) max_teams[i] = max(max_teams[i], 1); if (i + 1 - a[i] > 0) max_teams[i] = max(max_teams[i], 1 + max_teams[i-a[i]]); } cout << max_teams[N-1] << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...