답안 #685875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
685875 2023-01-25T02:38:52 Z null_awe Colors (BOI20_colors) C++14
0 / 100
0 ms 208 KB
#include <iostream>
using namespace std;

#define int long long

int n, at;

bool qry(int x) {
  if (at <= n / 2) at += x;
  else at -= x;
  cout << "? " << at << endl;
  bool ans; cin >> ans;
  return ans;
}

int32_t main() {
  cin >> n;
  bool added = true;
  at = 1;
  int test = 0;
  for (int i = 62; i >= 0; --i) {
    int chg = test + (1LL << i);
    if (chg >= n) continue;
    if (!added) at += 1LL << i;
    added = !added, test = chg;
  }
  cout << "? " << at << endl;
  int tmp; cin >> tmp;
  int sum = 0;
  for (int i = 62; i >= 0; --i) {
    int chg = sum + (1LL << i);
    if (chg >= n) continue;
    if (!qry(chg)) sum = chg;
  }
  cout << "= " << sum + 1 << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB OK (4 queries)
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB OK (4 queries)
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB OK (4 queries)
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB OK (4 queries)
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB OK (4 queries)
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -