# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875420 | ElenaBM | Teams (CEOI11_tea) | C++17 | 415 ms | 26176 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;
int main()
{
int n;
cin>> n;
vector<int>a;
vector<pair<int,int>>v(n);
for (int i = 0; i < n; ++i){
int x;
cin>> x;
v[i] = {x, i+1};
}
sort(v.begin(), v.end());
int num = 0, ans = 0;
int i = n-1;
while(i >= 0){
if (i - v[i].first >= 0){
int aux = i;
i -= (v[i].first-1);
ans++;
if (i - (v[i].first-1) < 0){
//cout<< i - (v[i].first-1)<< '\n';
a.push_back(aux+1);
}
else a.push_back(v[aux].first);
}
else break;
}
cout<< ans << '\n';
i = n-1;
for (int j = 0; j < (int) a.size(); ++j){
cout<< a[j]<< ' ';
while(a[j]){
cout<< v[i].second<< ' ';
i--;
a[j]--;
}
cout<< '\n';
}
return 0;
}
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... |