Submission #908828

# Submission time Handle Problem Language Result Execution time Memory
908828 2024-01-16T23:48:27 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
6 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
void invita (const vector<int> &v, int otro)
{
	cout << v.size()+1 << " ";
	for (int x: v) cout << x << " ";
	cout << otro << endl;
}
int color[155];
void solve()
{
	int n, x; cin >> n;
	vector<int> p = {1};
	color[1] = 1;
	
	for (int i = 2; i <= n; i++)
	{
		invita(p, i);
		cin >> x;
		if(x==1){
		    color[i]=color[1];
		    continue;
		}
		if (x > p.size())
		{
			p.push_back(i);
			color[i] = p.size();
			continue;
		}
		int l = 0, r = p.size()-1;
		int aux = 0;
		while (l <= r)
		{
			int mit = (l+r) >> 1;
			vector<int> temp;
			for (int j = aux; j <= mit; j++)
				temp.push_back(p[j]);
			invita(temp, i);
			cin >> x;
			if(x==1){
			    color[i]=color[temp[0]];
			    break;
			}
			if (x == temp.size())
			{
				r = mit;
				continue;
			}
			l = mit+1;
			aux = l;

		}
//		color[i] = l;
	}
	cout << "0 ";
	for (int i = 1; i <= n; i++)
		cout << color[i] << " ";
	cout << endl;
}
int main() 
{
	int t = 1; //cin >> t;
	while (t--)
		solve();
	return 0;
}

Compilation message

carnival.cpp: In function 'void solve()':
carnival.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   if (x > p.size())
      |       ~~^~~~~~~~~~
carnival.cpp:44:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |    if (x == temp.size())
      |        ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 4 ms 596 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 432 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 440 KB Output is correct