Submission #498690

# Submission time Handle Problem Language Result Execution time Memory
498690 2021-12-26T07:20:09 Z devomega07 Colors (BOI20_colors) C++14
0 / 100
1 ms 200 KB
#include "bits/stdc++.h"
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long l;
void output(int num){
	cout << "? " << num << '\n';
	cout.flush();
	return;
}
void input(bool &ok){
	int num;
	cin >> num;
	ok = bool(num);
	return;
}
int main()
{
	int n, num; cin >> n;
	int high=n, low=1, llast=INT_MIN;
	cout << "? 0" << endl;
	cin>>num;
	while(1){
	 	int mid = (high+low)>>1;
		output(mid);
		bool ok; input(ok);
		if(high==low) {cout << "= " << llast << endl; return 0;}
		if(ok)	high = mid-1;
		else	low = mid+1;
		if(ok) llast = mid;
	}
	return 0;
}


# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -