結果

問題 No.2252 Find Zero
ユーザー tsugutsugu
提出日時 2023-03-24 21:24:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 1,646 ms
コンパイル使用メモリ 166,204 KB
実行使用メモリ 25,476 KB
平均クエリ数 78.17
最終ジャッジ日時 2024-09-18 16:40:32
合計ジャッジ時間 3,880 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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 / 2; i++) {
        cout << "? " << 2 * i << ' ' << 2 * i + 1 << endl;
        int z;
        cin >> z;
        if (z == 2 * i) {
            cout << "! " << 2 * i + 1 << endl;
            return 0;
        } else if (z == 2 * i + 1) {
            cout << "! " << 2 * i << endl;
            return 0;
        }
    }
    cout << n - 1 << endl;
}
0