結果

問題 No.716 距離
ユーザー ixTL255
提出日時 2023-01-14 01:45:18
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 16,323 ms
コンパイル使用メモリ 379,692 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 21:40:48
合計ジャッジ時間 18,068 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();

    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<isize> = itr.map(|x| x.parse().unwrap()).collect();

    let mx = a[n - 1] - a[0];
    let mut mn = a[1] - a[0];
    for i in 1..n - 1 {
        if mn > a[i + 1] - a[i] { mn = a[i + 1] - a[i]; }
    }
    println!("{}", mn);
    println!("{}", mx);
}
0