結果

問題 No.716 距離
ユーザー Masaki Kitaguchi
提出日時 2022-01-09 03:00:06
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 12,865 ms
コンパイル使用メモリ 393,268 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 10:10:21
合計ジャッジ時間 14,481 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut buf = String::new();
    let mut input = {
        use std::io::Read;
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.split_whitespace()
    };

    let n: usize = input.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| input.next().unwrap().parse().unwrap())
        .collect();

    let min = (0..(n - 1)).map(|i| a[i + 1] - a[i]).min().unwrap();
    let max = a[n - 1] - a[0];

    println!("{}", min);
    println!("{}", max);
}
0