Submission #501187

# Submission time Handle Problem Language Result Execution time Memory
501187 2022-01-02T14:48:55 Z akshtsinghania Colors (BOI20_colors) C++14
0 / 100
0 ms 200 KB
#include <bits/stdc++.h>
using namespace std;


#define int long long
#define N "\n";


void solve(){
	int n;
	cin>>n;
	int l=1,r=n;
	int ans=(l+r)/2;
	while(l<=r){
		int mid=(l+r)/2;
		cout<<"? "<<mid<<endl;
		int is_noticed;
		cin>>is_noticed;
		if(is_noticed){
			l=mid+1;
			ans=min(ans,mid);
		}
		else{
			r=mid-1;
		}
	}
	cout<<"= "<<ans<<endl;
}


signed main(){
	cout.tie(NULL);
	cin.tie(NULL);
	ios_base::sync_with_stdio(NULL);
	int t=1;
	// cin>>t;
	while(t--)solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (3 queries)
2 Incorrect 0 ms 200 KB Wrong guess
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (3 queries)
2 Incorrect 0 ms 200 KB Wrong guess
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (3 queries)
2 Incorrect 0 ms 200 KB Wrong guess
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (3 queries)
2 Incorrect 0 ms 200 KB Wrong guess
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (3 queries)
2 Incorrect 0 ms 200 KB Wrong guess
3 Halted 0 ms 0 KB -