Submission #773194

#TimeUsernameProblemLanguageResultExecution timeMemory
773194NK_Teams (CEOI11_tea)C++17
0 / 100
248 ms32744 KiB
// Success consists of going from failure to failure without loss of enthusiasm #include <bits/stdc++.h> using namespace std; #define nl '\n' template<class T> using V = vector<T>; int main() { cin.tie(0)->sync_with_stdio(0); int N; cin >> N; V<int> A(N); for(auto& x : A) cin >> x; V<pair<int, int>> B; for(int i = 0; i < N; i++) B.push_back(make_pair(A[i], i)); sort(rbegin(B), rend(B)); V<V<int>> C; for(int i = 0; i < N; i++) { int left = N - i; if (left < B[i].first) C.back().push_back(B[i].second); else { int r = i + B[i].first; C.push_back({}); for(int x = i; x < r; x++) C.back().push_back(B[x].second); i = r - 1; } } cout << size(C) << nl; for(auto v : C) { cout << size(v) << " "; for(auto x : v) cout << x + 1 << " "; cout << nl; } return 0; }
#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...