Submission #710555

#TimeUsernameProblemLanguageResultExecution timeMemory
710555groshiTeams (CEOI11_tea)C++17
80 / 100
398 ms82632 KiB
#include<bits/stdc++.h> using namespace std; vector<int> wypisz[1000006]; priority_queue<pair<int,int> > kolejka; int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int n; cin>>n; vector<pair<int,int> > Q; for(int i=1;i<=n;i++) { int x; cin>>x; Q.push_back({x,i}); } sort(Q.begin(),Q.end()); int ktora=1; for(int i=Q.size()-1;i>=0;i--) { int ile=Q[i].first; if(i+1<ile) { pair<int,int> para=kolejka.top(); kolejka.pop(); wypisz[para.second].push_back(Q[i].second); kolejka.push({-wypisz[para.second].size(),para.second}); } else{ for(int j=i;j>i-ile;j--) wypisz[ktora].push_back(Q[j].second); kolejka.push({-wypisz[ktora].size(),ktora}); i-=ile; i++; ktora++; } } cout<<ktora-1<<"\n"; for(int i=1;i<ktora;i++) { cout<<wypisz[i].size()<<" "; for(int j=0;j<wypisz[i].size();j++) cout<<wypisz[i][j]<<" "; cout<<"\n"; } return 0; }

Compilation message (stderr)

tea.cpp: In function 'int32_t main()':
tea.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int j=0;j<wypisz[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...