# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76790 | kdh9949 | Teams (CEOI11_tea) | C++17 | 340 ms | 36704 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, a[N], p[N];
vector<vector<int>> r;
int main(){
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", a + i);
iota(p, p + n, 0);
sort(p, p + n, [](int x, int y){ return a[x] > a[y]; });
for(int i = 0, j; i < n; i += j){
j = a[p[i]];
if(i + j > n){
for(int k = i, c = r.size() - 1; k < n; k++, c--){
if(c < 0) c = r.size() - 1;
r[c].push_back(p[k] + 1);
}
break;
}
r.push_back(vector<int>());
for(int k = i; k < i + j; k++) r.back().push_back(p[k] + 1);
}
printf("%d\n", r.size());
for(const vector<int> &i : r){
printf("%d ", i.size());
for(int j : i) printf("%d ", j);
puts("");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |