結果

問題 No.1219 Mancala Combo
ユーザー YamaKasaYamaKasa
提出日時 2020-09-17 23:21:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 164,056 KB
実行使用メモリ 6,800 KB
最終ジャッジ日時 2023-09-04 08:02:17
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 35 ms
5,608 KB
testcase_18 WA -
testcase_19 AC 31 ms
5,348 KB
testcase_20 WA -
testcase_21 AC 27 ms
5,088 KB
testcase_22 WA -
testcase_23 AC 43 ms
6,228 KB
testcase_24 WA -
testcase_25 AC 30 ms
5,360 KB
testcase_26 WA -
testcase_27 AC 49 ms
6,748 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll b[N]{};
    if (A[N - 1] != 0 && A[N - 1] != N) {
        cout << "No\n";
        return 0;
    }
    if (A[N - 1] == N) {
        b[N - 1] = 1;
    }
    for (int i = N - 2; i >= 1; i--) {
        if ((A[i] + b[i + 1]) % (i + 1) != 0) {
            cout << "No\n";
            return 0;
        }
        b[i] += (A[i] + b[i + 1]) / (i + 1);
    }
    cout << "Yes\n";
    return 0;
}
0