結果
問題 | No.1219 Mancala Combo |
ユーザー |
|
提出日時 | 2023-02-07 17:01:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 1,390 bytes |
コンパイル時間 | 3,211 ms |
コンパイル使用メモリ | 229,184 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 12:49:22 |
合計ジャッジ時間 | 5,028 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> #include "atcoder/all" #define debug cout << "OK" << endl; template<typename T> inline bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; } template<typename T> inline bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; } inline int Code(char c) { if ('A' <= c and c <= 'Z')return (int)(c - 'A'); if ('a' <= c and c <= 'z')return (int)(c - 'a'); if ('0' <= c and c <= '9')return (int)(c - '0'); assert(false); } using namespace std; using namespace atcoder; #define int long long constexpr int MOD = 998244353; constexpr int INF = (1LL << 62); using minit = modint998244353; template<typename T> ostream& operator << (ostream& st, const vector<T> &v) { for (const T value : v) { st << value << " "; } return st; } template<typename T> istream& operator >> (istream& st, vector<T>& v) { for (T &value : v) { st >> value; } return st; } // // void solve() { int N; cin >> N; vector<int> A(N); cin >> A; int sum = 0; for (int i = N - 1; 0 <= i; i--) { if (i + 1 < A[i] or (A[i] + sum) % (i + 1)) { cout << "No" << endl; return; } sum += (A[i] + sum) / (i + 1); } cout << "Yes" << endl; return; } signed main() { int T = 1; // cin >> T; for (int i = 0; i < T; i++) solve(); return 0; } /* * わらびのコードこーどすぺーす (σ・∀・)σゲッツ!! */