제출 #1278924

#제출 시각아이디문제언어결과실행 시간메모리
1278924rtriColors (BOI20_colors)C++20
9 / 100
1 ms400 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

bool ask(ll p) {
  cout << "? " << p << endl;
  bool ans;
  cin >> ans;
  return ans;
}

int main() {
  ll n;
  cin >> n;

  ll l = 1;
  ll r = n;

  ask(l++);
  bool one = true;
  int c = n;
  while (l < r) {
    if (!ask(r--)) {
      one = false;
      break;
    }
    c--;
    if (!ask(l++)) {
      one = false;
      break;
    }
    c--;
  }

  if (n % 2 == 0 && one && ask(l))
    c = 1;

  cout << "= " << c << endl;

  return 0;
}
#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...