Submission #715332

# Submission time Handle Problem Language Result Execution time Memory
715332 2023-03-26T13:42:50 Z study Carnival (CEOI14_carnival) C++17
0 / 100
5 ms 208 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 151;

int color[N];
vector<int> people;

int query(vector<int>& v){
	cout << v.size();
	for (int i:v) cout << ' ' << i;
	cout << endl;
	int a;
	cin >> a;
	return a;
}

int query(int deb, int fin, int pos){
	cout << fin-deb+2;
	for (int i=deb; i<=fin; ++i){
		cout << ' ' << people[i];
	}
	cout << ' ' << pos;
	cout << endl;
	int a;
	cin >> a;
	return a;
}

void dc(int deb, int fin, int pos){
	if (deb == fin){
		color[pos] = color[deb];
		return;
	}
	int mid = (deb+fin)/2;
	if (query(deb,mid,pos) == mid-deb+1){
		dc(deb,mid,pos);
	}
	else dc(mid+1,fin,pos);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	int prev = 0;
	for (int i=1; i<=n; ++i){
		people.emplace_back(i);
		if (query(people) != prev+1){
			people.pop_back();
		}
		else prev++;
	}
	int ans = 1;
	for (int i:people){
		color[i] = ans;
		ans++;
	}
	for (int i=1; i<=n; ++i){
		if (color[i] == 0){
			dc(0,people.size()-1,i);
		}
	}
	cout << 0;
	for (int i=1; i<=n; ++i){
		cout << ' ' << color[i];
	}
	cout << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 208 KB Integer 0 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 208 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 208 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 208 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -