Submission #607479

# Submission time Handle Problem Language Result Execution time Memory
607479 2022-07-26T18:11:40 Z hail Carnival (CEOI14_carnival) C++17
100 / 100
26 ms 284 KB
#include <bits/stdc++.h>

using namespace std;

vector<int> final(0);
int c;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin>>n;
	final.resize(n+1);
	fill(final.begin(), final.end(), 0);

	final[1]=1;
	c = 1;

	int high;
	int low;
	int mid;

	int num_types;
	int verify_types;

	for(int i = 2; i<=n; i++)
	{
		cout<<i<<" ";
		for(int j=1; j<=i; j++)
		{
			cout<<j<<" ";
		}
		cout<<endl;
		cin>>num_types;

		if(num_types!=c)
		{
			final[i] = c+1;
			c++;
		}
		else
		{
			low = 1;
			high = i-1;
			while(high-low>1)
			{
				mid = (high + low)/2;

				cout<<mid<<" ";
				for(int j=1; j<=mid; j++)
				{
					cout<<j<<" ";
				}
				cout<<endl;

				cin>>num_types;

				cout<<mid+1<<" ";
				for(int j=1; j<=mid; j++)
				{
					cout<<j<<" ";
				}
				cout<<i<<endl;

				cin>>verify_types;

				if(verify_types==num_types) high = mid;
				else low = mid;
			}

			cout<<2<<" "<<low<<" "<<i<<endl;
			cin>>num_types;

			if(num_types==1) final[i] = final[low];
			else final[i] = final[high];
		}
		
	}

	cout<<0<<" ";

	for(int i=1; i<=n; i++)
	{
		cout<<final[i]<<" ";
	}
	cout<<endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 17 ms 284 KB Output is correct
6 Correct 15 ms 208 KB Output is correct
7 Correct 13 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 208 KB Output is correct
2 Correct 20 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 17 ms 208 KB Output is correct
6 Correct 17 ms 208 KB Output is correct
7 Correct 17 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 208 KB Output is correct
2 Correct 20 ms 208 KB Output is correct
3 Correct 17 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 16 ms 208 KB Output is correct
6 Correct 18 ms 208 KB Output is correct
7 Correct 18 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 208 KB Output is correct
2 Correct 17 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 11 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 17 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 208 KB Output is correct
2 Correct 21 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 12 ms 208 KB Output is correct
5 Correct 11 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct