結果

問題 No.1219 Mancala Combo
ユーザー k
提出日時 2020-09-05 07:08:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 195,840 KB
最終ジャッジ日時 2025-01-14 06:58:42
ジャッジサーバーID
(参考情報)
judge3 / 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<int> a(n+1);
  REP (i, n) cin >> a[i+1];

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

  bool ck = true;
  REP (i, n) {
    if ((sum[n] - sum[i]) % (i+1))
      ck = false;
  }

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