# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
773224 |
2023-07-04T17:03:49 Z |
NK_ |
Teams (CEOI11_tea) |
C++17 |
|
514 ms |
124300 KB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define f first
#define s second
#define mp make_pair
#define sz(x) int(x.size())
using pi = pair<int, int>;
template<class T> using V = vector<T>;
int main() {
cin.tie(0)->sync_with_stdio(0);
int N; cin >> N;
V<int> A(N); for(auto& x : A) cin >> x;
V<pi> B; for(int i = 0; i < N; i++) B.push_back(mp(A[i], i));
sort(rbegin(B), rend(B));
V<V<int>> C;
multiset<pi> siz;
for(int i = 0; i < N; i++) {
int left = N - i;
if (left < B[i].first) {
int idx = (*begin(siz)).s;
siz.erase(begin(siz));
C[idx].push_back(B[i].second);
siz.insert(mp(sz(C[idx]), idx));
} else {
int r = i + B[i].first;
C.push_back({});
for(int x = i; x < r; x++) C.back().push_back(B[x].second);
siz.insert(mp(sz(C.back()), sz(C) - 1));
i = r - 1;
}
}
int mx = 0; for(auto v : C) mx = max(mx, sz(v));
// cout << mx << nl;
cout << sz(C) << nl;
for(auto v : C) {
cout << sz(v) << " ";
for(auto x : v) cout << x + 1 << " ";
cout << nl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
2640 KB |
Output is correct |
2 |
Correct |
16 ms |
2524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2832 KB |
Output is correct |
2 |
Correct |
19 ms |
2768 KB |
Output is correct |
3 |
Correct |
19 ms |
2816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
167 ms |
18504 KB |
Output is correct |
2 |
Correct |
161 ms |
20848 KB |
Output is correct |
3 |
Correct |
169 ms |
23376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
24472 KB |
Output is correct |
2 |
Correct |
514 ms |
124300 KB |
Output is correct |
3 |
Correct |
210 ms |
27148 KB |
Output is correct |
4 |
Correct |
201 ms |
25612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
235 ms |
26672 KB |
Output is correct |
2 |
Correct |
159 ms |
28152 KB |
Output is correct |
3 |
Correct |
234 ms |
24508 KB |
Output is correct |
4 |
Correct |
236 ms |
24580 KB |
Output is correct |