Submission #529605

# Submission time Handle Problem Language Result Execution time Memory
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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -