# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
227717 | 2020-04-28T14:56:47 Z | dolphingarlic | Teams (CEOI11_tea) | C++14 | 549 ms | 81848 KB |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[1000001]; vector<vector<int>> teams; priority_queue<pair<int, int>> pq; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", &a[i].first); a[i].second = i; } sort(a + 1, a + n + 1); while (n) { if (a[n].first > n) { int sz, idx; tie(sz, idx) = pq.top(); pq.pop(); teams[idx].push_back(a[n--].second); pq.push({sz - 1, idx}); } else { int ptr = n; teams.push_back({}); while (n - ptr != a[n].first) teams.back().push_back(a[ptr--].second); pq.push({-teams.back().size(), teams.size() - 1}); n = ptr; } } printf("%d\n", teams.size()); for (vector<int> i : teams) { printf("%d", i.size()); for (int j : i) printf(" %d", j); printf("\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2296 KB | Output is correct |
2 | Correct | 30 ms | 2168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 2560 KB | Output is correct |
2 | Correct | 30 ms | 2304 KB | Output is correct |
3 | Correct | 35 ms | 2552 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 267 ms | 15864 KB | Output is correct |
2 | Correct | 264 ms | 18908 KB | Output is correct |
3 | Correct | 276 ms | 20044 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 380 ms | 20360 KB | Output is correct |
2 | Correct | 549 ms | 81848 KB | Output is correct |
3 | Correct | 352 ms | 24884 KB | Output is correct |
4 | Correct | 359 ms | 22156 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 382 ms | 22588 KB | Output is correct |
2 | Correct | 297 ms | 30812 KB | Output is correct |
3 | Correct | 343 ms | 23800 KB | Output is correct |
4 | Correct | 389 ms | 25184 KB | Output is correct |