# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
530137 | 2022-02-24T17:00:13 Z | peuch | Teams (CEOI11_tea) | C++17 | 578 ms | 121660 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; int n; pair<int, int> v[MAXN]; vector<vector<int> > group; set<pair<int, int> > tam; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%d", &v[i].first); v[i].second = i; } sort(v + 1, v + 1 + n); reverse(v + 1, v + 1 + n); for(int i = 1; i <= n; i++){ int cur = v[i].second; int qnt = v[i].first; if(qnt > n - i + 1){ int grp = tam.begin()->second; tam.erase(tam.begin()); group[grp].push_back(cur); tam.insert(make_pair(group[grp].size(), grp)); continue; } group.push_back(vector<int> (1, cur)); int idx = group.size() - 1; while(--qnt) group[idx].push_back(v[++i].second); tam.insert(make_pair(group[idx].size(), idx)); } printf("%lu\n", group.size()); for(int i = 0; i < group.size(); i++){ printf("%lu ", group[i].size()); for(int j = 0; j < group[i].size(); j++) printf("%d ", group[i][j]); printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 1876 KB | Output is correct |
2 | Correct | 19 ms | 2084 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 2000 KB | Output is correct |
2 | Correct | 19 ms | 2356 KB | Output is correct |
3 | Correct | 22 ms | 2464 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 196 ms | 14788 KB | Output is correct |
2 | Correct | 199 ms | 19484 KB | Output is correct |
3 | Correct | 194 ms | 19828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 261 ms | 19044 KB | Output is correct |
2 | Correct | 578 ms | 121660 KB | Output is correct |
3 | Correct | 283 ms | 25308 KB | Output is correct |
4 | Correct | 272 ms | 21912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 292 ms | 19060 KB | Output is correct |
2 | Correct | 213 ms | 27112 KB | Output is correct |
3 | Correct | 260 ms | 23624 KB | Output is correct |
4 | Correct | 302 ms | 24840 KB | Output is correct |