結果

問題 No.2252 Find Zero
ユーザー noya2
提出日時 2023-01-20 00:12:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 192,596 KB
最終ジャッジ日時 2025-02-10 04:14:41
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n; cin >> n;
    int ans = n-1;
    for (int i = 0; i < n/2; i++){
        cout << "? " << 2*i << " " << 2*i+1 << endl;
        int k; cin >> k;
        if (k == 2*i) ans = 2*i+1;
        if (k == 2*i+1) ans = 2*i;
    }
    cout << "! " << ans << endl;
}
0