Submission #204507

#TimeUsernameProblemLanguageResultExecution timeMemory
204507SaboonTeams (CEOI11_tea)C++14
0 / 100
343 ms22112 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; pair<int,int> a[maxn]; bool mark[maxn]; int main(){ ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 1; i <= n; i++){ int x; cin >> x; a[i] = {x, i}; } sort(a + 1, a + n + 1); int t = 0; int now = n; while (now > 1){ if (a[now].first > now){ now --; continue; } mark[now] = 1; t ++; now -= a[now].first; } cout << t << endl; int last = 0; for (int i = 1; i <= n; i++){ if (mark[i]){ cout << i - last << ' '; for (int j = last + 1; j <= i; j++) cout << a[j].second << ' '; last = i; cout << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...