結果

問題 No.1219 Mancala Combo
ユーザー merom686
提出日時 2020-09-05 00:53:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 91,364 KB
最終ジャッジ日時 2025-01-14 06:34:40
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int r = 1;
    ll t = 0;
    for (int i = n; i > 0; i--) {
        ll s = a[i] + t;
        if (a[i] <= i && s % i == 0) {
            t += s / i;
        } else {
            r = 0;
            break;
        }
    }

    cout << (r ? "Yes" : "No") << endl;

    return 0;
}
0