結果

問題 No.2252 Find Zero
ユーザー 👑 CleyL
提出日時 2023-03-25 23:28:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 75,108 KB
最終ジャッジ日時 2025-02-11 18:06:26
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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