Submission #858655

# Submission time Handle Problem Language Result Execution time Memory
858655 2023-10-09T04:17:09 Z maks007 Colors (BOI20_colors) C++14
0 / 100
3 ms 344 KB
#include "bits/stdc++.h"
 
using namespace std;
 
#define int long long
 
signed main () {
	int n;
	cin >> n;
	int l = 1, r = n+1, f = 1;
	cout << "? " << 1 << endl;
	int x;
	cin >> x;
	if(n > 64) {
		return 0;
	}
	while(1) {
		if(l==r)break;
		if(f == 1) {
			r --;
			cout << "? " << r << endl;
			cin >> x;
			if(x == 0) {
				assert(r-l<n);
				cout <<"= " << r-l+1 << endl;
				return 0;
			}
			f = -1;
		}else {
			l ++;
			cout << "? " << l << endl;
			cin >> x;
			if(x == 0) {
				assert(r-l<n);
				cout <<"= " << r-l+1 << endl;
				return 0;
			}
			f=1;
		}
	}
	cout << "= 0" << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -