結果
| 問題 |
No.1219 Mancala Combo
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-04 23:25:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 1,660 bytes |
| コンパイル時間 | 1,758 ms |
| コンパイル使用メモリ | 196,608 KB |
| 最終ジャッジ日時 | 2025-01-14 06:27:35 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
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;
}
#define DEBUG
#ifdef DEBUG
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << H;
debug_out(T...);
}
#define debug(...) \
cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
struct Setup {
Setup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
} __Setup;
using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//-------------------------------------
int main() {
int n;
cin >> n;
vector<int> a(n);
vector<ll> sum(n + 1, 0);
for(int i = 0; i < n; i++) {
cin >> a[i];
sum[i + 1] = sum[i] + a[i];
}
auto get = [&](int l, int r) { return sum[r] - sum[l]; };
bool ok = true;
for(int i = 0; i < n; i++) {
if(get(i, n) % (i + 1) != 0) {
ok = false;
}
}
cout << (ok ? "Yes" : "No") << endl;
}