結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー srjywrdnprkt
提出日時 2025-03-21 21:30:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 3,327 ms
コンパイル使用メモリ 273,652 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 21:30:44
合計ジャッジ時間 4,358 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>

using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint998244353;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll N, mi=1e9, mx=-1e9, A, S=0;
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> A;
        mi = min(mi, A);
        mx = max(mx, A);
    }

    if (mi > 0) cout << mx * 2 << endl;
    else if (mx < 0) cout << -mi * 2 << endl;
    else cout << (mx-mi) * 2 << endl;

    return 0;
}
0