Submission #530151

#TimeUsernameProblemLanguageResultExecution timeMemory
530151Kenzo_1114Teams (CEOI11_tea)C++17
30 / 100
464 ms72780 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > v(n); vector<vector<int> > g(0, vector<int>(0)); for(int i = 0; i < n; i++) { cin >> v[i].first; v[i].second = i + 1; } sort(v.begin(), v.end()); int r = (int) v.size() - 1; for(int i = (int) v.size() - 1; i >= 0; i--) { int val = v[r].first; if(r - i + 1 >= val) { vector<int> cur; for(int j = i; j <= r; j++) cur.push_back(v[j].second); g.push_back(cur); r = i - 1; } } int mx = 0; for(int i = 0; i < (int) g.size(); i++) mx = max(mx, (int) g[i].size()); while(0 <= r) { for(int i = 0; i < (int) g.size(); i++) while(0 <= r && (int) g[i].size() < mx) g[i].push_back(v[r--].second); mx++; } printf("%d\n", (int) g.size()); for(int i = 0; i < (int) g.size(); i++) { printf("%d ", (int) g[i].size()); for(int j = 0; j < (int) g[i].size(); j++) printf("%d ", g[i][j]); printf("\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...