Submission #1033135

# Submission time Handle Problem Language Result Execution time Memory
1033135 2024-07-24T13:12:51 Z goodspeed0208 Colors (BOI20_colors) C++14
0 / 100
1 ms 424 KB
#include<bits/stdc++.h>
using namespace std;
 
signed main() {
	int n;
	cin >> n;
	set<int>st;
	
	int c;
	if (n == 2) {
		cout << "? 1" << endl; cin >> c;
		cout << "? 2" << endl; cin >> c;
		if (c == 1) cout << "= 1" << endl;
		else cout << "= 2" << endl;
		return 0;
	} else if (n == 3) {
		cout << "? 2" << endl; cin >> c;
		cout << "? 3" << endl; cin >> c;
		if (c == 1) cout << "= 1" << endl;
		else {
			cout << "? 1" << endl; cin >> c;
			if (c == 1) cout << "= 2" << endl;
			else cout << "= 3" << endl;
		}
		return 0;
		
	}
	
	
		int l = 1, r = n, t = 1, ans= n;
		cout << "? " << 1 << endl; cin >> c;
		while (ans > 1) {
			if (t) {
				r--;
				assert(st.find(r) == st.end());
				cout << "? " << r << endl;
			} else {
				l++;
				assert(st.find(l) == st.end());
				cout << "? " << l << endl;
			}
			t ^= 1;
			cin >> c;
			if (c == 1) ans = r - l;
			else break;
		}
		cout << "= " << ans << endl;
		return 0;
	
}
 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (5 queries)
3 Correct 0 ms 344 KB OK (9 queries)
4 Correct 0 ms 344 KB OK (25 queries)
5 Correct 0 ms 344 KB OK (12 queries)
6 Correct 0 ms 344 KB OK (25 queries)
7 Correct 0 ms 344 KB OK (16 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 1 ms 344 KB OK (8 queries)
10 Correct 0 ms 344 KB OK (10 queries)
11 Correct 0 ms 424 KB OK (3 queries)
12 Correct 0 ms 344 KB OK (4 queries)
13 Correct 0 ms 344 KB OK (10 queries)
14 Correct 0 ms 344 KB OK (15 queries)
15 Correct 0 ms 344 KB OK (10 queries)
16 Correct 1 ms 344 KB OK (33 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (15 queries)
19 Incorrect 1 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (5 queries)
3 Correct 0 ms 344 KB OK (9 queries)
4 Correct 0 ms 344 KB OK (25 queries)
5 Correct 0 ms 344 KB OK (12 queries)
6 Correct 0 ms 344 KB OK (25 queries)
7 Correct 0 ms 344 KB OK (16 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 1 ms 344 KB OK (8 queries)
10 Correct 0 ms 344 KB OK (10 queries)
11 Correct 0 ms 424 KB OK (3 queries)
12 Correct 0 ms 344 KB OK (4 queries)
13 Correct 0 ms 344 KB OK (10 queries)
14 Correct 0 ms 344 KB OK (15 queries)
15 Correct 0 ms 344 KB OK (10 queries)
16 Correct 1 ms 344 KB OK (33 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (15 queries)
19 Incorrect 1 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (5 queries)
3 Correct 0 ms 344 KB OK (9 queries)
4 Correct 0 ms 344 KB OK (25 queries)
5 Correct 0 ms 344 KB OK (12 queries)
6 Correct 0 ms 344 KB OK (25 queries)
7 Correct 0 ms 344 KB OK (16 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 1 ms 344 KB OK (8 queries)
10 Correct 0 ms 344 KB OK (10 queries)
11 Correct 0 ms 424 KB OK (3 queries)
12 Correct 0 ms 344 KB OK (4 queries)
13 Correct 0 ms 344 KB OK (10 queries)
14 Correct 0 ms 344 KB OK (15 queries)
15 Correct 0 ms 344 KB OK (10 queries)
16 Correct 1 ms 344 KB OK (33 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (15 queries)
19 Incorrect 1 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (5 queries)
3 Correct 0 ms 344 KB OK (9 queries)
4 Correct 0 ms 344 KB OK (25 queries)
5 Correct 0 ms 344 KB OK (12 queries)
6 Correct 0 ms 344 KB OK (25 queries)
7 Correct 0 ms 344 KB OK (16 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 1 ms 344 KB OK (8 queries)
10 Correct 0 ms 344 KB OK (10 queries)
11 Correct 0 ms 424 KB OK (3 queries)
12 Correct 0 ms 344 KB OK (4 queries)
13 Correct 0 ms 344 KB OK (10 queries)
14 Correct 0 ms 344 KB OK (15 queries)
15 Correct 0 ms 344 KB OK (10 queries)
16 Correct 1 ms 344 KB OK (33 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (15 queries)
19 Incorrect 1 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (5 queries)
3 Correct 0 ms 344 KB OK (9 queries)
4 Correct 0 ms 344 KB OK (25 queries)
5 Correct 0 ms 344 KB OK (12 queries)
6 Correct 0 ms 344 KB OK (25 queries)
7 Correct 0 ms 344 KB OK (16 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 1 ms 344 KB OK (8 queries)
10 Correct 0 ms 344 KB OK (10 queries)
11 Correct 0 ms 424 KB OK (3 queries)
12 Correct 0 ms 344 KB OK (4 queries)
13 Correct 0 ms 344 KB OK (10 queries)
14 Correct 0 ms 344 KB OK (15 queries)
15 Correct 0 ms 344 KB OK (10 queries)
16 Correct 1 ms 344 KB OK (33 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (15 queries)
19 Incorrect 1 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -