結果

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

ソースコード

diff #

// 提出時にassertはオフ
#ifndef DEBUG
#ifndef NDEBUG
#define NDEBUG
#endif
#endif

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

#define ALL(x) (x).begin(), (x).end()
template <class T> using vec = vector<T>;

int main() {
    ios_base::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 ans;
        cin >> ans;
        if(ans == i) {
            cout << "! " << i + 1 << endl;
            return 0;
        }
        if(ans == i + 1) {
            cout << "! " << i << endl;
            return 0;
        }
    }
    cout << "! " << N - 1 << endl;
}
0