結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー じきお。
提出日時 2025-01-25 13:11:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 3,090 ms
コンパイル使用メモリ 274,988 KB
実行使用メモリ 25,856 KB
平均クエリ数 30.00
最終ジャッジ日時 2025-01-25 22:36:17
合計ジャッジ時間 6,509 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...)
#endif

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    auto check = [&](int x) -> bool {
        cout << x << endl;
        int r;
        cin >> r;
        if (r == -1) exit(0);
        return r == 1;
    };

    constexpr int M = 30;
    int ok = 0, ng = 1e9 + 1;
    for (int iter = 0; iter < M - 1; iter++) {
        int mid = midpoint(ok, ng);
        (check(mid) ? ok : ng) = mid;
    }

    check(ok);
}
0