답안 #529605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
529605 2022-02-23T08:56:29 Z Yazan_Alattar Colors (BOI20_colors) C++14
0 / 100
1 ms 200 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 100007;
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0};

ull n;

bool ask(ull x){
	if(x > n) return 1;
	cout << "? " << x << endl;
	bool ret;
	cin >> ret;
	return ret;
}

int main()
{
	cout.flush();
	cin >> n;
	
	ull l = 1, r = n + 1;
	while(l < r){
		ull mid = (l + r) / 2;
		ask(1);
		if(ask(mid + 1)) r = mid;
		else l = mid + 1;
	}
	
	cout << "= " << l << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -