Submission #750224

# Submission time Handle Problem Language Result Execution time Memory
750224 2023-05-29T08:05:38 Z tlnk07 Carnival (CEOI14_carnival) C++17
100 / 100
15 ms 296 KB
#include<bits/stdc++.h>
using namespace std;

long long n, a[1001], cur = 2, inp, color[1001];

int main()
{
	cin >> n;
	a[1] = 1;
	color[1] = 1;
	for(int i = 2; i <= n; ++i)
	{
		color[i] = 0;
		cout.flush() << cur << " ";
		for(int j = 1; j < cur; ++j)
		{
			cout.flush() << a[j] << " ";
		}
		cout.flush() << i << "\n";
		cin >> inp;
		if(inp == cur)
		{
			a[cur] = i;
			color[i] = cur;
			++cur;
		}
	}
	for(int i = 1; i <= n; ++i)
	{
		if(!color[i])
		{
			long long r = cur - 1, l = 1;
			while(r > l)
			{
				long long mid = (l + r) / 2;
				cout.flush() << mid - l + 2 << " ";
				for(int j = l; j <= mid; ++j)
				{
					cout.flush() << a[j] << " ";
				}
				cout.flush() << i << "\n";
				cin >> inp;
				if(inp == mid - l + 1)
				{
					r = mid;
				}
				else
				{
					l = mid + 1;
				}
			}
			color[i] = color[a[r]];
		}
	}
	cout.flush() << 0;
	for(int i = 1; i <= n; ++i)
	{
		cout.flush() << " " << color[i];
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 6 ms 272 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 10 ms 208 KB Output is correct
6 Correct 12 ms 208 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 296 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 11 ms 208 KB Output is correct
5 Correct 11 ms 208 KB Output is correct
6 Correct 13 ms 208 KB Output is correct
7 Correct 11 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 13 ms 208 KB Output is correct
4 Correct 15 ms 208 KB Output is correct
5 Correct 12 ms 208 KB Output is correct
6 Correct 9 ms 260 KB Output is correct
7 Correct 13 ms 208 KB Output is correct