제출 #1303392

#제출 시각아이디문제언어결과실행 시간메모리
1303392_asunaaColors (BOI20_colors)C++20
0 / 100
1 ms428 KiB
#include <bits/stdc++.h> using namespace std; long long i, j, l, r, mid, p, q, k, t, n, m, a, b, c, d, ans, cnt, res, arr[1000005]; const long long mod = 999993143, mod2 = 999993469; string s; bool check; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; a = 1; b = n; c = n / 2; l = 0; r = c - 1; t = -1; while (l <= r){ mid = (l + r) / 2; cout << "? " << c - mid << endl; cin >> d; if (t != -1){ if (d == 0){ a = max(a, abs((c - mid) - t) + 1); } else{ b = min(b, abs((c - mid) - t)); } } t = c - mid; cout << "? " << c + mid + 1 << endl; cin >> d; if (t != -1){ if (d == 0){ a = max(a, abs((c + mid + 1) - t) + 1); l = mid + 1; } else{ b = min(b, abs((c + mid + 1) - t)); r = mid - 1; } } t = c + mid + 1; // l = max(l, (a + 1) / 2); // r = min(r, (b + 1) / 2); } cout << "= " << a << endl; // cout << "= " << b << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...