結果

問題 No.2753 鳩の巣原理
コンテスト
ユーザー cled0328
提出日時 2024-05-10 22:13:40
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 391 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,182 ms
コンパイル使用メモリ 208,360 KB
実行使用メモリ 30,020 KB
平均クエリ数 11.00
最終ジャッジ日時 2026-07-04 17:20:30
合計ジャッジ時間 3,729 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main(){
    int n;cin>>n;
    int l=0,r=n;
    int ctl=1,ctr=n;
    for(int i=0;i<10;i++){
        int c=(l+r)/2;
        cout<<"? "<<c+1<<"\n";
        int ct;cin>>ct;
        if(ct-ctl<c-l){
            ctr=ct;
            r=c;
        }else{
            ctl=ct;
            l=c;
        }
    }
    cout<<"Yes "<<ctl<<" "<<ctl+1<<"\n";
}
0