Submission #906033

# Submission time Handle Problem Language Result Execution time Memory
906033 2024-01-13T10:54:01 Z 8pete8 Teams (CEOI11_tea) C++17
80 / 100
269 ms 80876 KB
#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

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 time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 3248 KB Output is correct
2 Correct 16 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 3548 KB Output is correct
2 Correct 17 ms 2908 KB Output is correct
3 Correct 18 ms 3288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 23976 KB Output is correct
2 Correct 150 ms 23928 KB Output is correct
3 Correct 155 ms 25744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 214 ms 34460 KB Output is correct
2 Correct 269 ms 80876 KB Output is correct
3 Correct 197 ms 31372 KB Output is correct
4 Correct 192 ms 27404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 241 ms 37020 KB Output is correct
2 Correct 152 ms 38472 KB Output is correct
3 Correct 208 ms 30968 KB Output is correct
4 Correct 246 ms 31804 KB Output is correct