結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー yiwiy9
提出日時 2025-01-25 15:48:24
言語 Rust
(1.83.0 + proconio)
結果
RE  
実行時間 -
コード長 648 bytes
コンパイル時間 30,123 ms
コンパイル使用メモリ 403,216 KB
実行使用メモリ 26,248 KB
平均クエリ数 12.66
最終ジャッジ日時 2025-01-25 23:48:43
合計ジャッジ時間 15,845 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 RE * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::{input, source::line::LineSource};
use std::io::{stdin, stdout, BufReader, Write};

fn main() {
    let stdin = stdin();
    let mut source = LineSource::new(BufReader::new(stdin.lock()));

    let mut left = 0;
    let mut right = 1 << 30;
    while right - left > 1 {
        let mid = (right + left) / 2;

        println!("{}", mid);
        stdout().flush().unwrap();

        input! {
            from &mut source,
            ok: i64,
        }

        if ok == 1 {
            left = mid;
        } else if ok == 0 {
            right = mid;
        } else {
            break;
        }
    }

    println!("! {}", left);
}
0