結果

問題 No.2252 Find Zero
ユーザー Nzt3
提出日時 2023-03-24 21:45:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 191,692 KB
最終ジャッジ日時 2025-02-11 17:11:45
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  for(int i=0;i<N-1;i+=2){
    cout<<"? "<<i<<' '<<i+1<<endl;
    int z;
    cin>>z;
    if(z==i){
      cout<<"! "<<i+1<<endl;
      return 0;
    }
    if(z==i+1){
      cout<<"! "<<i<<endl;
      return 0;
    }
  }
  cout<<"! "<<N-1<<endl;
}
0