Submission #906033

#TimeUsernameProblemLanguageResultExecution timeMemory
9060338pete8Teams (CEOI11_tea)C++17
80 / 100
269 ms80876 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<float.h> #include<limits.h> #include <cassert> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> //gcd(a,b) #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,ll> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound using namespace std; #define int long long #define double long double #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-loops") const int mod=98765431,mxn=1e4,lg=22;//inf=1e18,minf=-1e9,Mxn=100000; int32_t main(){ fastio int n;cin>>n; vector<pii>v(n); int mx=0,cnt=0; vector<vector<int>>ans; for(int i=0;i<n;i++)cin>>v[i].f,v[i].s=i+1,mx=max(mx,v[i].f); sort(rall(v)); int cur=0; while(cur<n){ if(n-cur>=v[cur].f){ vector<int>tmp; for(int i=cur;i<cur+v[cur].f;i++)tmp.pb(v[i].s); cur+=v[cur].f; ans.pb(tmp); } else{ while(cnt<ans.size()&&ans[cnt].size()==mx)cnt++; if(cnt==ans.size())cnt=0,mx++; ans[cnt].pb(v[cur++].s); } } cout<<ans.size()<<'\n'; for(auto i:ans){ cout<<i.size()<<" "; for(auto j:i)cout<<j<<" "; cout<<'\n'; } }

Compilation message (stderr)

tea.cpp: In function 'int32_t main()':
tea.cpp:55:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |    while(cnt<ans.size()&&ans[cnt].size()==mx)cnt++;
      |          ~~~^~~~~~~~~~~
tea.cpp:55:41: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   55 |    while(cnt<ans.size()&&ans[cnt].size()==mx)cnt++;
      |                          ~~~~~~~~~~~~~~~^~~~
tea.cpp:56:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |    if(cnt==ans.size())cnt=0,mx++;
      |       ~~~^~~~~~~~~~~~
#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...