結果

問題 No.2753 鳩の巣原理
ユーザー maguroflymagurofly
提出日時 2024-05-10 21:52:18
言語 Rust
(1.77.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 22,632 ms
コンパイル使用メモリ 401,864 KB
実行使用メモリ 25,484 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-10 21:52:46
合計ジャッジ時間 18,149 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,848 KB
testcase_01 AC 21 ms
25,476 KB
testcase_02 AC 21 ms
24,976 KB
testcase_03 AC 21 ms
25,232 KB
testcase_04 AC 22 ms
24,976 KB
testcase_05 AC 25 ms
24,976 KB
testcase_06 AC 22 ms
24,976 KB
testcase_07 AC 22 ms
25,484 KB
testcase_08 AC 27 ms
24,976 KB
testcase_09 AC 20 ms
25,220 KB
testcase_10 AC 20 ms
25,220 KB
testcase_11 AC 21 ms
24,836 KB
testcase_12 AC 21 ms
24,580 KB
testcase_13 AC 22 ms
24,580 KB
testcase_14 AC 21 ms
24,580 KB
testcase_15 AC 22 ms
24,580 KB
testcase_16 AC 21 ms
24,964 KB
testcase_17 AC 21 ms
24,836 KB
testcase_18 AC 20 ms
25,220 KB
testcase_19 AC 20 ms
25,476 KB
testcase_20 AC 21 ms
24,964 KB
testcase_21 AC 19 ms
24,580 KB
testcase_22 AC 23 ms
24,836 KB
testcase_23 AC 20 ms
24,580 KB
testcase_24 AC 21 ms
25,220 KB
testcase_25 AC 20 ms
24,836 KB
testcase_26 AC 22 ms
25,220 KB
testcase_27 AC 22 ms
24,836 KB
testcase_28 AC 27 ms
24,964 KB
testcase_29 AC 21 ms
24,964 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
 --> src/main.rs:5:9
  |
5 |         N: usize,
  |         ^ help: convert the identifier to snake case: `n`
  |
  = note: `#[warn(non_snake_case)]` on by default

ソースコード

diff #

use proconio::input_interactive;

fn main() {
	input_interactive! {
        N: usize,
	}

    // if N == 2 {
    //     for i in 1 ..= 10 {
    //         println!("? {i}");
    //         input_interactive!(_: usize);
    //         println!("Yes 1 2");
    //         return;
    //     }
    // }
	
    let mut l = 1;
    let mut r = N;
    for _ in 1 ..= 10 {
        let mid = (l + r + 1) / 2;
        println!("? {}", mid);
        input_interactive!(count: usize);
        if count >= mid {
            l = mid;
        } else {
            r = mid;
        }
    }

    println!("Yes {l} {r}");
}
0