답안 #501241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501241 2022-01-02T16:46:56 Z akshtsinghania Colors (BOI20_colors) C++14
0 / 100
1 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 min_diff=n;
	int previous=1;
	int q=0;
	cout<<"? "<<1<<endl;
	int t;cin>>t;
	while(l<=r){
		int mid=(l+r)/2;
		cout<<"? "<<previous+mid<<endl;
		int detect;
		cin>>detect;
		if(detect){
			r=mid-1;
			min_diff=min(min_diff,mid);
		}
		else{
			l=mid+1;
		}
		previous=mid;
		q++;
	}
	cout<<"= "<<min_diff<<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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 5 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 5 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 5 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 5 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 5 was used multiple times
2 Halted 0 ms 0 KB -