# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111372 | khoaha123 | Teams (CEOI11_tea) | C++17 | 211 ms | 24828 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>
#define endl '\n'
#define ii pair<int,int>
#define task ""
#define all(x) x.begin(),x.end()
using namespace std;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-9;
const int dx[2] = {1,0};
const int dy[2] = {0,1};
int n,a[N];
ii b[N];
vector<vector<int>> ans;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
if (fopen(task".INP","r")){
freopen(task".INP","r",stdin);
freopen(task".OUT","w",stdout);
}
cin >> n;
for (int i = 1; i <= n; ++i){
cin >> a[i];
b[i] = ii(a[i],i);
}
sort(b+1,b+1+n,greater<ii>());
int i = 1;
int res = 1;
int cnt = 1;
//3 2 2 2 1
while (i <= n){
i++;
if (cnt >= b[i-cnt].first){
vector<int> x;
for (int j = i - cnt; j < i; ++j) x.push_back(b[j].second);
ans.push_back(x);
cnt = 1;
}
else {
cnt++;
}
}
cout << ans.size() << endl;
for (auto f : ans){
cout << f.size() << ' ';
for (auto g : f) cout << g << ' ';
cout << endl;
}
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... |