結果

問題 No.3066 Collecting Coins Speedrun 1
コンテスト
ユーザー AngrySadEight
提出日時 2025-02-05 00:21:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 71,252 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-02-17 00:09:26
合計ジャッジ時間 2,336 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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