結果

問題 No.2252 Find Zero
ユーザー CleyLCleyL
提出日時 2023-03-25 23:28:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 76,952 KB
実行使用メモリ 24,636 KB
平均クエリ数 109.00
最終ジャッジ日時 2023-10-19 07:42:56
合計ジャッジ時間 4,164 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int main(){
    int n;cin>>n;
    set<int> A;
    int c = 0;
    for(int i = 0; n > i; i++){
        if(A.count(i))continue;
        if(n/2 == c){
          cout << "! " << i << endl;
          return 0;
        }
        cout << "? " << i << " " << i << endl;
        c++;
        int x;cin>>x;
        if(i==x){
            cout << "! " << i << endl;
            return 0;
        }
        A.insert(x);
    }
}
0