結果

問題 No.1219 Mancala Combo
ユーザー 钟梓皓
提出日時 2020-09-04 21:29:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 2,977 ms
コンパイル使用メモリ 191,152 KB
最終ジャッジ日時 2025-01-14 05:06:29
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

const int N = 200010;
using ll = long long;

int a[N];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i){
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; ++ i){
        if (a[i] > i){
            puts("No");
            return 0;
        }
    }
    ll offset = 0;
    for (int i = n; i >= 1; -- i){
        a[i] += offset;
        if (a[i] % i){
            puts("No");
            return 0;
        }
        offset += a[i] / i;
    }
    puts("Yes");
    return 0;
}
0