Submission #299559

# Submission time Handle Problem Language Result Execution time Memory
299559 2020-09-15T07:38:57 Z E869120 Colors (BOI20_colors) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int Debug = 1;
long long N;
long long C = 10;
long long prevs = 0;

int getans(long long pos) {
	cout << "? " << pos << endl;
	if (Debug == 1) {
		int x;
		cin >> x;
		return x;
	}
	if (Debug == 2) {
		int x = -1;
		if (abs(prevs - pos) < C) x = 0;
		else x = 1;
		prevs = pos;
		return x;
	}
	return -1;
}

int main() {
	// Step #1. Input
	cin >> N;
	
	// Step #2. Get Answer
	int cl = 1, cr = N, cm, minx = N;
	for (int i = 0; i < 32; i++) {
		cm = (cl + cr) / 2;
		getans(1);
		int z = getans(1 + cm);
		if (z == 1) { minx = min(minx, cm); cr = cm; }
		else { cl = cm; }
	}
	cout << "= " << minx << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -