# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875450 | 2023-11-19T17:58:30 Z | ElenaBM | Teams (CEOI11_tea) | C++17 | 408 ms | 77516 KB |
#include <bits/stdc++.h> #define x first #define y second using namespace std; int main() { int n, aux; cin>> n; vector<int>a, s(1); vector<pair<int,int>>v(n); vector<vector<int>>teams(1); for (int i = 0; i < n; ++i){ int u; cin>> u; v[i] = {u, i+1}; } sort(v.begin(), v.end(), greater()); teams[0].push_back(v[0].y); int mx = v[0].x; s[0] = v[0].x -1; int cur = 0; for (int i = 1; i <n; ++i){ if (s[cur] > 0){ teams[cur].push_back(v[i].y); s[cur]--; } else{ if(v[i].x > n - i){ //mejor idea --> repartir a esta gente entre los grupos pequeños for (int u = i; u < n; ++u){ if ((int)teams[cur].size() < mx) teams[cur].push_back(v[u].y); else{ if(cur > 0) { cur--; u--; } else { mx++; cur = (int)teams.size()-1; u--; } } } break; } teams.push_back(vector<int>()); cur++; teams[cur].push_back(v[i].y); s.push_back(v[i].x-1); } } cout<< (int)teams.size() << '\n'; for (int i = 0; i < (int) teams.size(); ++i){ cout<< (int) teams[i].size()<< ' '; for (int j = 0; j < (int)teams[i].size(); ++j){ cout<< teams[i][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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 404 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 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 | 348 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 1840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 1908 KB | Output is correct |
2 | Correct | 21 ms | 2132 KB | Output is correct |
3 | Correct | 30 ms | 2128 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 251 ms | 14996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 356 ms | 19512 KB | Output is correct |
2 | Correct | 318 ms | 77516 KB | Output is correct |
3 | Incorrect | 299 ms | 21904 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 408 ms | 18992 KB | Output is correct |
2 | Correct | 328 ms | 19132 KB | Output is correct |
3 | Incorrect | 310 ms | 19796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |