Submission #132564

#TimeUsernameProblemLanguageResultExecution timeMemory
132564VardanyanTeams (CEOI11_tea)C++14
0 / 100
342 ms27940 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000*1000+5; pair<int,int> a[N]; int main(){ ios_base::sync_with_stdio(false); int n; cin>>n; for(int i = 1;i<=n;i++){ cin>>a[i].first; a[i].second = i; } sort(a+1,a+1+n); vector<vector<int> > ans; vector<int> now; int lim = n+1; for(int i = n;i>=1;i--){ if(i>=lim){ now.push_back(a[i].second); continue; } if(now.size()) ans.push_back(now); now.clear(); lim = i-a[i].first+1; now.push_back(a[i].second); } if(now.size()) ans.push_back(now); cout<<ans.size()<<endl; for(int i = 0;i<ans.size();i++){ cout<<ans[i].size()<<" "; for(int j = 0;j<ans[i].size();j++) cout<<ans[i][j]<<" "; cout<<endl; } return 0; }

Compilation message (stderr)

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