結果

問題 No.1219 Mancala Combo
ユーザー c-yanc-yan
提出日時 2020-09-04 21:56:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 353 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 108,436 KB
最終ジャッジ日時 2024-05-04 22:15:12
合計ジャッジ時間 5,034 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
57,728 KB
testcase_01 AC 34 ms
52,096 KB
testcase_02 AC 33 ms
52,096 KB
testcase_03 AC 32 ms
52,352 KB
testcase_04 AC 101 ms
76,416 KB
testcase_05 AC 91 ms
76,160 KB
testcase_06 AC 99 ms
76,384 KB
testcase_07 AC 92 ms
76,032 KB
testcase_08 AC 109 ms
76,672 KB
testcase_09 AC 39 ms
52,480 KB
testcase_10 AC 38 ms
52,096 KB
testcase_11 AC 91 ms
76,160 KB
testcase_12 AC 51 ms
61,952 KB
testcase_13 AC 84 ms
75,904 KB
testcase_14 AC 34 ms
52,096 KB
testcase_15 AC 35 ms
52,608 KB
testcase_16 AC 34 ms
52,224 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

N, *A = map(int, open(0).read().split())

q = []
for i in range(N):
    if A[i] == i + 1:
        heappush(q, i)

while q:
    i = heappop(q)
    A[i] = 0
    for j in range(i):
        A[j] += 1
        if A[j] == j + 1:
            heappush(q, j)

if all(a == 0 for a in A):
    print('Yes')
else:
    print('No')
0