結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー atcoder8
提出日時 2025-03-21 21:50:27
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 14,199 ms
コンパイル使用メモリ 377,520 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-21 21:50:44
合計ジャッジ時間 14,046 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    println!("{}", solve());
}

fn solve() -> i64 {
    input! {
        n: usize,
        cc: [i64; n],
    }

    let min_c = *cc.iter().min().unwrap();
    let max_c = *cc.iter().max().unwrap();

    if min_c >= 0 {
        return 2 * max_c;
    }

    if max_c <= 0 {
        return -2 * min_c;
    }

    2 * (max_c - min_c)
}
0