Submission #673749

#TimeUsernameProblemLanguageResultExecution timeMemory
673749meowwTeams (CEOI11_tea)C++14
30 / 100
1505 ms74696 KiB
#include "bits/stdc++.h" using namespace std; signed main() { int n; cin>>n; pair<int,int> v[n]; for (int i=0;i<n;i++) { cin>>v[i].first; v[i].second=i; } sort(v,v+n); vector<vector<int> > tms; int j=n-1; for (int i=n-1;i>=0;i--) { int nm=v[i].first; vector<int> tmp; while (j>=0 && nm>0) { tmp.push_back(v[j].second); nm--; j--; } if (nm>0) { priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq; for (int p=0;p<tms.size();p++) pq.push({tms[p].size(),p}); int ntmp=0; while (ntmp<tmp.size()) { int ii=pq.top().second; tms[ii].push_back(tmp[ntmp]); ntmp++; pq.pop(); pq.push({tms[ii].size(),ii}); } } else { tms.push_back(tmp); i=j+1; } } cout<<tms.size()<<endl; for (int i=0;i<tms.size();i++) { cout<<tms[i].size()<<' '; for (int j:tms[i]) cout<<j+1<<' '; cout<<endl; } }

Compilation message (stderr)

tea.cpp: In function 'int main()':
tea.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int p=0;p<tms.size();p++) pq.push({tms[p].size(),p});
      |                      ~^~~~~~~~~~~
tea.cpp:24:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         while (ntmp<tmp.size()) {
      |                ~~~~^~~~~~~~~~~
tea.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i=0;i<tms.size();i++) {
      |                  ~^~~~~~~~~~~
#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...