結果

問題 No.1219 Mancala Combo
ユーザー Atomic67Atomic67
提出日時 2020-09-08 23:20:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,428 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 164,928 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-20 10:45:15
合計ジャッジ時間 3,015 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 13 ms
4,376 KB
testcase_18 AC 15 ms
4,376 KB
testcase_19 AC 12 ms
4,376 KB
testcase_20 AC 16 ms
4,376 KB
testcase_21 AC 10 ms
4,376 KB
testcase_22 AC 14 ms
4,376 KB
testcase_23 AC 15 ms
4,376 KB
testcase_24 AC 12 ms
4,380 KB
testcase_25 AC 11 ms
4,376 KB
testcase_26 AC 15 ms
4,380 KB
testcase_27 AC 18 ms
4,376 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using ll = long long;

template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
struct Unionfind {
    vector<int> par;

    Unionfind(int n) : par(n) {
        for(int i = 0; i < n; ++i) par[i] = i;
    }

    int root(int x) {
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] =ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<int> a(n+1);
    bool flag1 = true;
    bool equal_i = false;
    int iv = n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];

        if(a[i] > i) {
            cout << "No" << endl;
            return 0;
        }
    }

    int v = 0;
    for(int i = n; i >= 1; --i) {
        if((a[i] + v) % i != 0) {
            cout << "No" << endl;
            return 0;
        }
        v += (a[i] + v) / i;
    }
    cout << "Yes" << endl;
    return 0;
}
0