結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

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

  int n;
  cin >> n;
  vector<long long> a(n+1);
  REP (i, n) cin >> a[i+1];

  bool ck = true;
  long long carry = 0;
  for (int i = n; i >= 1; i--) {
    a[i] += carry;
    if (a[i] % i)
      ck = false;
    else
      carry += a[i] / i;
  }

  if (ck)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}
0