結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー AngrySadEight
提出日時 2025-02-05 00:20:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 72,156 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-17 00:09:21
合計ジャッジ時間 2,494 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> c(N);
    for (int i = 0; i < N; i++) {
        cin >> c[i];
    }
    int ans = 0;
    if (c[N - 1] > 0) {
        ans += 2 * c[N - 1];
    }
    if (c[0] < 0) {
        ans += 2 * (-c[0]);
    }
    cout << ans << endl;
}
0