Submission #211237

#TimeUsernameProblemLanguageResultExecution timeMemory
211237mr_stefanTeams (CEOI11_tea)C++14
0 / 100
713 ms49504 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]; 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 (j=0; j<V[i].size(); j++) cout << V[i][j] << " "; cout << '\n'; } return 0; }

Compilation message (stderr)

tea.cpp: In function 'int main()':
tea.cpp:50:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j=0; j<V[i].size(); j++)
                   ~^~~~~~~~~~~~
#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...