# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875441 | 2023-11-19T17:11:27 Z | lalig777 | Teams (CEOI11_tea) | C++14 | 2500 ms | 19132 KB |
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; int main(){ int n; cin>>n; vector<int>aux; vector<pair<int,int> >children(n); vector<pair<int, vector<int> > >teams; for (int i=0; i<n; i++){ cin>>children[i].first; children[i].second=i+1; }sort(children.begin(), children.end()); teams.push_back(make_pair(children[n-1].first, aux)); teams[0].second.push_back(children[n-1].second); int current_teams=1; for (int i=n-2; i>=0; i--){ if (teams[0].first>teams[0].second.size()){ teams[0].second.push_back(children[i].second); }else{ if (children[i].first>i+1){ teams[0].first++; teams[0].second.push_back(children[i].second); }else{ teams.push_back(make_pair(children[i].first, aux)); teams[current_teams].second.push_back(children[i].second); current_teams++; } }sort(teams.begin(), teams.end()); }cout<<current_teams<<'\n'; for (int i=0; i<current_teams; i++){ cout<<teams[i].first; for (int j=0; j<teams[i].first; j++) cout<<" "<<teams[i].second[j]; cout<<'\n'; }return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 1884 KB | Output is correct |
2 | Correct | 801 ms | 2040 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 1944 KB | Output is correct |
2 | Execution timed out | 2519 ms | 1672 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 599 ms | 14832 KB | Output is correct |
2 | Execution timed out | 2541 ms | 6908 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 368 ms | 18988 KB | Output is correct |
2 | Execution timed out | 2525 ms | 8624 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 382 ms | 18988 KB | Output is correct |
2 | Correct | 338 ms | 19132 KB | Output is correct |
3 | Execution timed out | 2529 ms | 10948 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |