Submission #211238

#TimeUsernameProblemLanguageResultExecution timeMemory
211238mr_stefanTeams (CEOI11_tea)C++14
0 / 100
687 ms42916 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int VAL=1000005; int N, i, j, nr, M; pair <int, int> elev[VAL]; vector <int> V[VAL]; vector <int> :: iterator it; bool cmp(pair <int, int> A, pair <int, int> B) { return A.first>B.first; } int main() { cin >> N; for (i=1; i<=N; i++) { cin >> elev[i].first; elev[i].second=i; } sort(elev+1, elev+N+1, cmp); for (i=1; i<=N; i++) { if (nr>0) { nr--; V[M].push_back(elev[i].second); } else { if (elev[i].first<=N-i+1) { M++; V[M].push_back(elev[i].second); nr=elev[i].first-1; } else V[M].push_back(elev[i].second); } } cout << M << '\n'; for (i=1; i<=M; i++) { cout << V[i].size() << " "; for (it=V[i].begin(); it!=V[i].end(); it++) cout << *it << " "; cout << '\n'; } 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...