Submission #779803

# Submission time Handle Problem Language Result Execution time Memory
779803 2023-07-11T21:45:57 Z NK_ Carnival (CEOI14_carnival) C++17
0 / 100
13 ms 448 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'

template<class T> using V = vector<T>;
int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int N; cin >> N;
	V<int> P(N, -1);

	map<pair<int, int>, int> ASK;

	auto ask = [&](int x, int l, int r) {
		pair<int, int> q = make_pair(l, r);

		int res1;
		if (ASK.find(q) != ASK.end()) {
			cout << r - l + 1 << " ";
			for(int i = l; i <= r; i++) cout << " " << i + 1;
			cout << endl;

			cin >> res1; // WITHOUT
			ASK[q] = res1;
		} else res1 = ASK[q];

		cout << r - l + 1 + 1 << " " << x + 1;
		for(int i = l; i <= r; i++) cout << " " << i + 1;
		cout << endl;
	
		int res2; cin >> res2; // WITH

		return res1 == res2;
	};

	for(int i = 0; i < N; i++) {
		int lo = i, hi = N - 1;
		while(lo < hi) {
			int mid = (lo + hi + 1) / 2;
			if (ask(i, mid, hi)) lo = mid;
			else hi = mid - 1;
		}
		P[i] = lo;
	}	

	V<int> C(N, -1); int cur = 1;
	for(int i = N-1; i >= 0; i--) {
		if (C[P[i]] == -1) C[i] = cur++;
		else C[i] = C[P[i]];
	}

	cout << 0;
	for(auto x : C) cout << " " << x;
	cout << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 336 KB Integer 46 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 320 KB Integer 42 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 448 KB Integer 35 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 336 KB Integer 40 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 208 KB Integer 40 violates the range [1, 2]
2 Halted 0 ms 0 KB -