結果

問題 No.2252 Find Zero
ユーザー maguromaguro
提出日時 2023-03-24 21:29:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,089 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 200,436 KB
実行使用メモリ 24,660 KB
平均クエリ数 2.00
最終ジャッジ日時 2023-10-18 20:46:08
合計ジャッジ時間 4,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
constexpr int Inf = 1000000010;
constexpr long long INF= 2000000000000000000;

template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T,typename U>
T modpow(T N, U P, T M = -1) {
    if(P < 0) return 0;
    T ret = 1;
    if(M != -1) ret %= M;
    while(P) {
        if(P & 1) {
            if(M == -1) ret *= N;
            else ret = ret * N % M;
        }
        P /= 2;
        if(M == -1) N *= N;
        else N = N * N % M;
    }
    return ret;
}

constexpr long long MOD = 998244353;

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