結果

問題 No.2252 Find Zero
ユーザー planesplanes
提出日時 2023-03-24 22:03:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 166,860 KB
実行使用メモリ 24,720 KB
平均クエリ数 105.72
最終ジャッジ日時 2023-10-18 21:04:32
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
24,648 KB
testcase_01 AC 73 ms
24,648 KB
testcase_02 WA -
testcase_03 AC 63 ms
24,648 KB
testcase_04 AC 55 ms
24,648 KB
testcase_05 AC 53 ms
24,648 KB
testcase_06 AC 54 ms
24,648 KB
testcase_07 AC 54 ms
24,648 KB
testcase_08 AC 63 ms
24,648 KB
testcase_09 AC 65 ms
24,648 KB
testcase_10 WA -
testcase_11 AC 53 ms
24,648 KB
testcase_12 AC 53 ms
24,648 KB
testcase_13 AC 52 ms
24,648 KB
testcase_14 WA -
testcase_15 AC 53 ms
24,648 KB
testcase_16 AC 53 ms
24,648 KB
testcase_17 AC 54 ms
24,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)


int main() {
ll N;cin>>N;
for(ll i=1;i<N;i+=2) {
  cout<<"? "<<i<<" "<<i+1<<endl;
  ll z;cin>>z;
  if(z==i) {
    cout<<"! "<<i+1<<endl;
    return 0;
  }
  else if(z==i+1) {
    cout<<"! "<<i<<endl;
    return 0;

  }
}

cout<<"! "<<N<<endl;
}
0