結果

問題 No.1478 Simple Sugoroku
ユーザー phsplsphspls
提出日時 2022-10-07 23:29:39
言語 Rust
(1.77.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 947 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 138,996 KB
実行使用メモリ 4,700 KB
最終ジャッジ日時 2023-09-03 15:56:02
合計ジャッジ時間 5,483 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 7 ms
4,672 KB
testcase_14 AC 6 ms
4,624 KB
testcase_15 AC 7 ms
4,676 KB
testcase_16 AC 7 ms
4,644 KB
testcase_17 AC 6 ms
4,600 KB
testcase_18 AC 7 ms
4,664 KB
testcase_19 AC 7 ms
4,608 KB
testcase_20 AC 7 ms
4,688 KB
testcase_21 AC 7 ms
4,604 KB
testcase_22 AC 7 ms
4,640 KB
testcase_23 AC 7 ms
4,692 KB
testcase_24 AC 6 ms
4,684 KB
testcase_25 AC 7 ms
4,608 KB
testcase_26 AC 7 ms
4,676 KB
testcase_27 AC 7 ms
4,700 KB
testcase_28 AC 6 ms
4,380 KB
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 5 ms
4,384 KB
testcase_31 AC 5 ms
4,404 KB
testcase_32 AC 6 ms
4,392 KB
testcase_33 AC 6 ms
4,488 KB
testcase_34 AC 6 ms
4,492 KB
testcase_35 AC 6 ms
4,476 KB
testcase_36 AC 6 ms
4,472 KB
testcase_37 AC 6 ms
4,500 KB
testcase_38 AC 7 ms
4,492 KB
testcase_39 AC 6 ms
4,568 KB
testcase_40 AC 7 ms
4,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut nm = String::new();
    std::io::stdin().read_line(&mut nm).ok();
    let nm: Vec<usize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nm[0];
    let m = nm[1];
    let mut b = String::new();
    std::io::stdin().read_line(&mut b).ok();
    let b: Vec<usize> = b.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    if m == 1 {
        println!("{}", n-1);
        return;
    }
    let result = n - b[m-1] + b[0] - 1;
    let mut summary = vec![0usize; m];
    for i in (0..m-1).rev() {
        summary[i] = summary[i+1] + b[i+1] - b[i];
    }
    let mut sumval = 0usize;
    let mut minval = (b[m-1] - b[0]) as f64;
    for i in (1..m).rev() {
        sumval += summary[i];
        let exp = m as f64 / (m - i) as f64;
        let rest = sumval as f64 / (m - i) as f64;
        minval = minval.min(exp + rest);
    }
    println!("{:.09}", result as f64 + minval);
}
0