結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー hirakuuuu
提出日時 2025-01-25 12:36:08
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 936 bytes
コンパイル時間 3,475 ms
コンパイル使用メモリ 272,648 KB
実行使用メモリ 25,984 KB
平均クエリ数 31.00
最終ジャッジ日時 2025-01-25 22:05:47
合計ジャッジ時間 6,674 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double

// using mint = modint1000000007;
// using mint = modint998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1e18;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}



int main(){
    int M = 30;
    auto query = [&](int x) -> int{
        assert(M >= 1);
        cout << x << endl;
        M--;

        int r; cin >> r;
        return r;
    };

    int ok = 0, ng = 1e9+1;
    while(ng-ok > 1 && M >= 1){
        int mid = (ok+ng)/2;
        if(query(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}
0