結果

問題 No.1219 Mancala Combo
ユーザー hiro71687k
提出日時 2023-03-02 06:21:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 4,243 ms
コンパイル使用メモリ 251,740 KB
最終ジャッジ日時 2025-02-11 00:55:55
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.14159265359;
ll inf=80010010;
ll mod=1000000007;
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n+1);
    for (ll i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    ll now=0;
    bool ok=true;
    for (ll i = n; i >=1; i--)
    {
        if (a[i]>i)
        {
            ok=false;
            break;
        }
        if ((a[i]+now)%i!=0)
        {
            ok=false;
            break;
        }else{
            now+=(a[i]+now)/i;
        }
    }
    if (ok)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}
0