結果

問題 No.2836 Comment Out
ユーザー kenti
提出日時 2024-08-09 22:02:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 94,520 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-08-09 22:02:40
合計ジャッジ時間 4,807 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const int MAX_N = 200000;
int N, ct;
int A[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    ct = 1;
    for (int i = 0; i < N; i++) {
        if (A[i] <= abs(ct))
            ct = ((ct + 1 == 0) ? 1 : ct + 1);
        else if (ct > 0)
            ct -= A[i];
        else
            ct = -A[i] + 1;
    }
    cout << ((ct < 0) ? "No" : "Yes") << endl;
    return 0;
}
0