結果

問題 No.716 距離
コンテスト
ユーザー mk
提出日時 2022-01-09 03:00:06
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 919µs
コード長 511 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,071 ms
コンパイル使用メモリ 194,816 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-09-22 07:46:07
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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