Submission #444988

# Submission time Handle Problem Language Result Execution time Memory
444988 2021-07-16T07:35:25 Z fuad27 Carnival (CEOI14_carnival) C++14
100 / 100
10 ms 200 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int r;
int A[300] = {0};
int C[300] = {0};
int m = 0;
int p(int l, int r, int x) {
	cout << r - l + 2 << ' ' << x << ' ';
	for(int i = l; i <= r; i ++) cout << C[i] << ' ';
	cout << endl;
	cin >> x;
	return x;
}
int32_t main () {
	int n;
	cin >> n;
	A[1] = ++m;
	C[1] = 1;
	for(int i = 2;i<=n;i++) {
		int N = p(1, m, i);
		if(N > m) {
			A[i] = ++m;C[m] = i;
		}
		else {
			int low = 1, hight = m;
			while(low < hight) {
				int mid = (low+hight) >> 1;
				if(p(low, mid, i) == mid + 1 - low) {
					hight = mid;
				}
				else {
					low = mid + 1;
				}
			}
			A[i] = A[C[low]];
		}
	}
	A[0] = 0;
	for(int i = 0;i<=n;i++) {
		cout<<A[i]<<' ';
	}
	cout<<endl;
	fflush(stdout);
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 9 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 3 ms 200 KB Output is correct
6 Correct 4 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 10 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
5 Correct 8 ms 200 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 10 ms 200 KB Output is correct
3 Correct 8 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 3 ms 200 KB Output is correct