結果

問題 No.1478 Simple Sugoroku
ユーザー StrorkisStrorkis
提出日時 2021-04-17 13:15:23
言語 Rust
(1.72.1)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 897 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 153,956 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 21:17:35
合計ジャッジ時間 3,028 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 8 ms
4,380 KB
testcase_14 AC 8 ms
4,376 KB
testcase_15 AC 8 ms
4,380 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 AC 8 ms
4,376 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 9 ms
4,380 KB
testcase_21 AC 8 ms
4,376 KB
testcase_22 AC 8 ms
4,376 KB
testcase_23 AC 9 ms
4,380 KB
testcase_24 AC 8 ms
4,380 KB
testcase_25 AC 8 ms
4,376 KB
testcase_26 AC 9 ms
4,376 KB
testcase_27 AC 9 ms
4,384 KB
testcase_28 AC 7 ms
4,376 KB
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 7 ms
4,376 KB
testcase_31 AC 7 ms
4,380 KB
testcase_32 AC 7 ms
4,380 KB
testcase_33 AC 7 ms
4,380 KB
testcase_34 AC 7 ms
4,376 KB
testcase_35 AC 8 ms
4,380 KB
testcase_36 AC 8 ms
4,376 KB
testcase_37 AC 8 ms
4,380 KB
testcase_38 AC 8 ms
4,380 KB
testcase_39 AC 7 ms
4,376 KB
testcase_40 AC 7 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let ref mut buf = Vec::new();
    std::io::Read::read_to_end(&mut std::io::stdin(), buf).ok();
    let mut iter = std::str::from_utf8(buf).unwrap().split_whitespace();

    macro_rules! scan {
        ([$t:tt; $n:expr]) => ((0..$n).map(|_| scan!($t)).collect::<Vec<_>>());
        (($($t:tt),*)) => (($(scan!($t)),*));
        ($t:ty) => (iter.next().unwrap().parse::<$t>().unwrap());
    }

    let (n, m) = scan!((f64, usize));
    let b = scan!([f64; m]);

    let first = b.first().unwrap();
    let last = b.last().unwrap();

    let mut res = f64::MAX;
    let mut sum = m as f64;
    for (k, b) in b.iter().enumerate().rev() {
        if k == 0 {
            res = res.min(last - first);
        } else {
            sum += last - b;
            res = res.min(sum / (m - k) as f64);
        }
    }

    let ans = (first - 1.0) + res + (n - last);
    println!("{}", ans);
}
0