結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー zeronosu77108
提出日時 2025-03-22 00:03:15
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 12,075 ms
コンパイル使用メモリ 386,180 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-22 00:03:31
合計ジャッジ時間 13,788 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        n: usize,
        c: [i64; n]
    }
    
    let min = c.iter().min().unwrap();
    let max = c.iter().max().unwrap();
    
    let mut ans = i64::MAX;
    
    ans = ans.min(max.abs() + (max-min).abs() + min.abs());
    
    println!("{}", ans);
}
0