結果
問題 |
No.1219 Mancala Combo
|
ユーザー |
![]() |
提出日時 | 2024-02-24 16:38:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 330 ms |
コンパイル使用メモリ | 82,816 KB |
実行使用メモリ | 103,424 KB |
最終ジャッジ日時 | 2024-09-29 10:03:44 |
合計ジャッジ時間 | 3,422 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
# 一番右端で数字のあるものから、すべて連続に以下が必要 # 初期値がidx以下で、上から降ってくる数と初期値の和がそのidxの倍数 N = int(input()) A = [0]+list(map(int, input().split())) cumu = 0 on_off = False ans = 'Yes' for idx in range(N, 0, -1): #print(idx, A[idx]) if on_off == False: if A[idx] > 0: on_off = True if A[idx] != idx: ans = 'No' else: cumu = 1 else: if (A[idx]+cumu)%idx != 0: ans = 'No' else: cumu += (A[idx]+cumu)//idx #print('idx', idx, 'on_off', on_off, 'ans', ans, 'cumu', cumu) print(ans)