結果

問題 No.1219 Mancala Combo
ユーザー Riuya Hayashi
提出日時 2020-09-04 22:16:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 70,288 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-26 13:13:58
合計ジャッジ時間 1,752 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

void solve()
{
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    int cnt = 0;
    while (A[N-1-cnt] == 0) ++cnt;

    for (int i = cnt; i < N; ++i){
        int num = N - i;
        int dis = i - cnt;
        // cout << A[N-1-i] << " " << dis << " " << num << endl;
        if ((A[N-1-i] + dis) % num == 0) continue;
        else {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}
0