結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー srtry
提出日時 2025-04-27 15:43:32
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 12,611 ms
コンパイル使用メモリ 391,200 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-27 15:43:48
合計ジャッジ時間 14,307 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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;
    }
    
    if c.len()==1 {
        ans = 2*min_x.abs() as usize;
    }

    println!("{}", ans);
}
0