# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
773304 |
2023-07-04T20:44:51 Z |
NK_ |
Teams (CEOI11_tea) |
C++17 |
|
195 ms |
40312 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(idx != sz(C) - 1);
// 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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
476 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
724 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
716 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
14 ms |
3676 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
15 ms |
3980 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
136 ms |
26668 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
185 ms |
35748 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
195 ms |
40312 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |