結果

問題 No.1219 Mancala Combo
ユーザー kyoskyos
提出日時 2020-09-04 23:01:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 167,688 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 03:32:20
合計ジャッジ時間 2,833 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
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 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 32 ms
5,376 KB
testcase_18 AC 40 ms
5,376 KB
testcase_19 AC 30 ms
5,376 KB
testcase_20 AC 42 ms
5,376 KB
testcase_21 AC 28 ms
5,376 KB
testcase_22 AC 36 ms
5,376 KB
testcase_23 AC 41 ms
5,376 KB
testcase_24 AC 30 ms
5,376 KB
testcase_25 AC 29 ms
5,376 KB
testcase_26 AC 41 ms
5,376 KB
testcase_27 AC 46 ms
5,376 KB
testcase_28 AC 59 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

bool getans()
{
    _LL n; cin >> n;
    vector<_LL> a(n);
    rep(i, n) cin >> a[i];
    _LL sum = 0;
    for( _LL k = n; k >= 1; k-- )
    {
        a[k - 1] += sum;
        if( a[k - 1] % k != 0 ) return false;
        sum += a[k - 1] / k;
    }
    return true;
}

int main()
{
    if( getans() )
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;    
}
0