Submission #500595

# Submission time Handle Problem Language Result Execution time Memory
500595 2021-12-31T13:52:27 Z REALITYNB Carnival (CEOI14_carnival) C++17
100 / 100
19 ms 304 KB
#include <bits/stdc++.h> 
#define pb push_back 
using namespace std;

int main() {
	int n; 
	cin>>n; 
	vector<vector<int>> a={{1}}; 
	for(int i=2;i<=n;i++){
		int l=-1,r=a.size(); 
		while(r-l!=1){
			int md=(r+l)/2; 
			vector<int> ask={i}; 
			for(int j=0;j<=md;j++) 
				for(int x : a[j])
					ask.push_back(x); 
			cout << ask.size() << " " ; 
			for(int y : ask)
				cout << y << " " ;
			cout << endl ; 
			int answer ; 
			cin>>answer; 
			if(answer==md+1) 
				r=md; 
			else
				l=md;
		}
		vector<int> nw = {i};
		if(r==a.size())
			a.pb(nw); 
		else
			a[r].pb(i); 
	}
	cout << 0 << " " ; 
	vector<int> answer(n+1); 
	for(int i=0;i<a.size();i++)
		for(int x : a[i])
			answer[x]=i+1;
	for(int i=1;i<=n;i++)
		cout << answer[i] << " " ; 
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:29:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   if(r==a.size())
      |      ~^~~~~~~~~~
carnival.cpp:36:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int i=0;i<a.size();i++)
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 200 KB Output is correct
2 Correct 11 ms 288 KB Output is correct
3 Correct 15 ms 300 KB Output is correct
4 Correct 13 ms 280 KB Output is correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 3 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 11 ms 200 KB Output is correct
3 Correct 11 ms 296 KB Output is correct
4 Correct 16 ms 200 KB Output is correct
5 Correct 8 ms 288 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 10 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 8 ms 292 KB Output is correct
4 Correct 10 ms 292 KB Output is correct
5 Correct 10 ms 212 KB Output is correct
6 Correct 6 ms 296 KB Output is correct
7 Correct 8 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 6 ms 288 KB Output is correct
3 Correct 14 ms 200 KB Output is correct
4 Correct 15 ms 292 KB Output is correct
5 Correct 19 ms 276 KB Output is correct
6 Correct 14 ms 276 KB Output is correct
7 Correct 11 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 13 ms 200 KB Output is correct
3 Correct 15 ms 200 KB Output is correct
4 Correct 15 ms 276 KB Output is correct
5 Correct 17 ms 276 KB Output is correct
6 Correct 17 ms 304 KB Output is correct
7 Correct 17 ms 300 KB Output is correct