# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
773228 |
2023-07-04T17:09:40 Z |
NK_ |
Teams (CEOI11_tea) |
C++17 |
|
479 ms |
125640 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;
assert(sz(C[idx])+1 >= B[i].first);
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 |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 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 |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
320 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 |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
456 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
2676 KB |
Output is correct |
2 |
Correct |
16 ms |
2488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
2896 KB |
Output is correct |
2 |
Correct |
25 ms |
2700 KB |
Output is correct |
3 |
Correct |
24 ms |
2764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
167 ms |
19884 KB |
Output is correct |
2 |
Correct |
163 ms |
22332 KB |
Output is correct |
3 |
Correct |
168 ms |
20656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
225 ms |
25796 KB |
Output is correct |
2 |
Correct |
479 ms |
125640 KB |
Output is correct |
3 |
Correct |
209 ms |
28644 KB |
Output is correct |
4 |
Correct |
225 ms |
22704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
237 ms |
28324 KB |
Output is correct |
2 |
Correct |
202 ms |
29636 KB |
Output is correct |
3 |
Correct |
234 ms |
26144 KB |
Output is correct |
4 |
Correct |
239 ms |
26288 KB |
Output is correct |