結果

問題 No.2753 鳩の巣原理
コンテスト
ユーザー aaaaaaaaaa2230
提出日時 2024-05-10 23:15:00
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 95 ms / 2,000 ms
+ 1µs
コード長 447 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,786 ms
コンパイル使用メモリ 333,612 KB
実行使用メモリ 9,844 KB
平均クエリ数 11.00
最終ジャッジ日時 2026-10-05 02:42:17
合計ジャッジ時間 4,151 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    int n;
    cin >> n;
    int l = 1,r = n;
    for (int i = 0; i < 10; i++){
        int m = (r+l)/2;
        cout << "? " << m << endl;
        int x;
        cin >> x;
        if (m > x){
            r = m;
        } else{
            l = m;
        }
    }
    cout << "Yes " << l << " " << r << endl;
    

    return 0;
}
0