Submission #834381

# Submission time Handle Problem Language Result Execution time Memory
834381 2023-08-22T13:49:58 Z vjudge1 Colors (BOI20_colors) C++17
0 / 100
1 ms 288 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll N, X, L, R, mid, tot = 0, tmp = 1, S;

int main () {
	cin >> N;
	L = 1;
	R = N;
	tmp = 1;
	while(L < R) {
		mid = (L+R)/2;
		tot += mid*tmp;
		tmp *= -1;
		X = min(X, tot);
		L = mid+1;
	}
	X = 1-X;
	cout << "? " << X << endl;
	cin >> S;
	L = 1;
	R = N;
	tmp = 1;
	while(L < R) {
		mid = (L+R)/2;
		X += mid*tmp;
		tmp *= -1;
		cout << "? " << X << endl;
		cin >> S;
		if (S==1) R = mid;
		else L = mid+1;
		
	}
	cout << "= " << L << endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -