# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370026 | 2021-02-22T23:49:07 Z | ijxjdjd | Teams (CEOI11_tea) | C++14 | 409 ms | 74920 KB |
#include <bits/stdc++.h> #define FR(i, N) for (int i = 0; i < int(N); i++) #define all(x) begin(x), end(x) using namespace std; using ll = long long; int main() { cin.tie(0); cin.sync_with_stdio(0); int N; cin >> N; vector<pair<int, int>> vec; FR(i, N) { int a; cin >> a; vec.emplace_back(a, i); } sort(all(vec)); vector<vector<int>> teams; for (int j = N-1; j >= 0;) { int k = vec[j].first; if (j >= k-1) { teams.push_back({}); while (k--> 0) { teams.back().push_back(vec[j].second); j--; } } else { while (k-->0 && j >= 0) { int mn = 100000; int mnI = -1; for (int c = 0; c < teams.size(); c++) { if (teams[c].size() < mn) { mn = teams[c].size(); mnI = c; } } teams[mnI].push_back(vec[j].second); j--; } } } cout << teams.size() << '\n'; for (auto& a : teams) { cout << a.size() << " "; for (int j : a) { cout << j+1<< " "; } cout << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 492 KB | Output is correct |
2 | Correct | 3 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 2408 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2664 KB | Output is correct |
2 | Correct | 22 ms | 2300 KB | Output is correct |
3 | Correct | 30 ms | 2684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 227 ms | 18776 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 319 ms | 25712 KB | Output is correct |
2 | Correct | 409 ms | 74920 KB | Output is correct |
3 | Incorrect | 296 ms | 24884 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 260 ms | 37488 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |