結果

問題 No.716 距離
ユーザー cra77756176
提出日時 2022-12-08 00:07:14
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 12,616 ms
コンパイル使用メモリ 377,396 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 03:12:40
合計ジャッジ時間 13,942 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut aa = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut aa).ok();
    let aa: Vec<i64> = aa.split_whitespace().skip(1).flat_map(str::parse).collect();

    let distances: Vec<i64> = aa.windows(2).map(|a| a[1] - a[0]).collect();

    println!("{}", distances.iter().min().unwrap());
    println!("{}", aa.last().unwrap() - aa.first().unwrap());
}
0