結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー srtry
提出日時 2025-04-27 15:37:15
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 12,556 ms
コンパイル使用メモリ 378,604 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-04-27 15:37:31
合計ジャッジ時間 14,940 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input!{
        n:usize,
        c:[isize;n],
    }

    let min_x:isize = *c.iter().min().unwrap();
    let max_x:isize = *c.iter().max().unwrap();
    
    let mut ans:usize = 2*(max_x - min_x) as usize;
    if min_x > 0 {
        ans += min_x as usize;
    } else if max_x < 0 {
        ans -= max_x as usize;
    }
    
    println!("{}", ans);
}
0