Submission #979184

# Submission time Handle Problem Language Result Execution time Memory
979184 2024-05-10T10:58:59 Z Amaarsaa Carnival (CEOI14_carnival) C++14
0 / 100
14 ms 596 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long ;
int ataman[152];
int Get(int x) {
	if ( x == ataman[x]) return x;
	return ataman[x] = Get(ataman[x]);
}
void Unite(int x, int y) {
	x = Get(x);
	y = Get(y);
	if ( x == y) return ;
	if ( x > y) swap(x, y);
	ataman[y] = x;
}
int Check(int l, int r) {
	
	cout << r- l + 1 << endl;
	for ( int i = l; i <= r; i ++) cout << i << " ";
	cout << endl;
	int x;
	cin >> x;
	return x;
}
int main() {
//	freopen("moocast.in", "r", stdin);
//	freopen("moocast.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n, i, lo, hi, mid, s, p;
	
	cin >> n;
	
	for (i = 1; i <= n; i ++) ataman[i] = i;
	for (i = 1; i+ 1 <= n; i ++) {
		s = Check(i, n);
		p = Check(i + 1, n);
		if ( s != p) continue;
		lo = i + 1;
		hi = n ;
		while ( lo < hi) {
			mid = (lo + hi)/2;
			s = Check(i, mid);
			p = Check(i + 1, mid);
			if ( s != p) lo = mid + 1;
			else hi = mid;
		}
		Unite(i, lo);
	}
	cout << "0 ";
	for (i = 1; i <= n; i ++) cout << Get(i) << " ";
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 344 KB Integer 19 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 344 KB Output is correct
2 Incorrect 14 ms 492 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 596 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 352 KB Output is correct
2 Incorrect 12 ms 344 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -