結果

問題 No.1219 Mancala Combo
ユーザー poohbearpoohbear
提出日時 2020-09-04 21:42:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,164 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 205,448 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-05-04 21:56:27
合計ジャッジ時間 4,532 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 RE -
testcase_03 AC 2 ms
5,376 KB
testcase_04 RE -
testcase_05 AC 2 ms
5,376 KB
testcase_06 RE -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 RE -
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 35 ms
6,528 KB
testcase_18 AC 40 ms
6,656 KB
testcase_19 AC 30 ms
6,400 KB
testcase_20 AC 42 ms
6,656 KB
testcase_21 AC 26 ms
5,888 KB
testcase_22 AC 34 ms
6,144 KB
testcase_23 AC 41 ms
7,296 KB
testcase_24 AC 29 ms
5,888 KB
testcase_25 AC 29 ms
6,016 KB
testcase_26 AC 40 ms
6,656 KB
testcase_27 AC 49 ms
7,936 KB
testcase_28 AC 57 ms
7,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(a,n) for (int a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<int,int> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

/*累積和
query(l,r)=引数に渡したvectorにおける[l,r)の和(0-indexed)
verified : https://judge.yosupo.jp/problem/static_range_sum
*/

template<typename T>
struct CumulativeSum{
    vector<T> res;
    CumulativeSum(const vector<T> vec){//初期化
        int sz = vec.size();
        res.resize(sz+1,0);
        for(int i=0;i<=sz;i++){
            res[i+1] = res[i]+vec[i];
        }
    }

    T query(int l, int r){
        return res[r]-res[l];
    }
};

int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    CumulativeSum<ll>cum(a);
    for(int i=0;i<n;i++){
        if(cum.query(i,n)%(i+1)!=0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

0