Submission #119040

# Submission time Handle Problem Language Result Execution time Memory
119040 2019-06-20T08:13:11 Z puppies_and_rainbows Carnival (CEOI14_carnival) C++14
100 / 100
14 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

bool taken[155];
int col[155];
int cntcol=0;
int n;
signed main()
{
	cin>>n;
	for(int tt=1; tt<=n; tt++)
	{
		vector<int> ask;
		for(int i=1; i<=tt; i++)
		{
			if(!taken[i])
			{
				ask.push_back(i);
			}
		}
		cout<<ask.size()<<" ";
		for(auto i:ask) cout<<i<<" ";
		cout<<endl;
//		ask.clear();
		int cac;
		cin>>cac;
		if(cac==ask.size())
		{
			cntcol++;
			col[tt]=cntcol;
		}
		else
		{
			int lo=1, hi=tt-1;
			while(lo<hi)
			{
				ask.clear();
				int mid=(lo+hi+1)/2;
				for(int i=mid; i<=tt; i++)
				if(!taken[i])
				{
					ask.push_back(i);
				}
				cout<<ask.size()<<" ";
				for(auto i:ask) cout<<i<<" ";
				cout<<endl;
				cin>>cac;
				if(cac==ask.size())
				{
					hi=mid-1;
				}
				else
				{
					lo=mid;
				}
			}
			col[tt]=col[lo];
			taken[tt]=true;
		}
	}
	cout<<0<<" ";
	for(int i=1; i<=n; i++)
	{
		cout<<col[i]<<" ";
	}
	cout<<endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:28:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(cac==ask.size())
      ~~~^~~~~~~~~~~~
carnival.cpp:49:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(cac==ask.size())
        ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 256 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 11 ms 256 KB Output is correct
4 Correct 3 ms 324 KB Output is correct
5 Correct 8 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 11 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 8 ms 256 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 11 ms 256 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct