Submission #383244

# Submission time Handle Problem Language Result Execution time Memory
383244 2021-03-29T09:48:36 Z mariowong Carnival (CEOI14_carnival) C++14
100 / 100
12 ms 492 KB
#include <bits/stdc++.h>
 
using namespace std;

int n,ans[155],x,ct,l,r,mid;
vector <int> pos;
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i=1;i<=n;i++){
		ans[i]=-1;
	}
	ans[1]=1; ct=1;pos.push_back(1);
	for (int i=2;i<=n;i++){
		cout << i << " "; 
		for (int j=1;j<=i;j++){
			cout << j << " ";
		}
		cout << "\n";
		fflush(stdout);
		cin >> x;
		if (x != ct){
			ct++;
			ans[i]=ct;
			pos.push_back(i);
		}
	}
	for (int i=1;i<=n;i++){
		if (ans[i] == -1){
			l=0; r=(int)pos.size()-1;
			while (l < r){
				mid=(l+r)/2;
				cout << mid+2 << " ";
				for (int j=0;j<=mid;j++){
					cout << pos[j] << " ";
				}
				cout << i << "\n";
				fflush(stdout);
				cin >> x;
				if (x != mid+1)
				l=mid+1;
				else
				r=mid;
			}
			ans[i]=ans[pos[l]];
		}
	}
	cout << "0 ";
	for (int i=1;i<=n;i++){
		cout << ans[i] << " ";
	}
	cout << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 4 ms 492 KB Output is correct
5 Correct 6 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 8 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 8 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 9 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 8 ms 364 KB Output is correct
6 Correct 9 ms 364 KB Output is correct
7 Correct 12 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 364 KB Output is correct
2 Correct 6 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 9 ms 364 KB Output is correct
6 Correct 9 ms 364 KB Output is correct
7 Correct 10 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 364 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 7 ms 364 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 6 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct