結果

問題 No.1219 Mancala Combo
ユーザー c-yanc-yan
提出日時 2020-09-04 21:59:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,620 KB
実行使用メモリ 107,720 KB
最終ジャッジ日時 2024-05-04 22:17:17
合計ジャッジ時間 4,872 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
57,856 KB
testcase_01 AC 33 ms
52,608 KB
testcase_02 AC 35 ms
52,352 KB
testcase_03 AC 34 ms
51,968 KB
testcase_04 AC 101 ms
76,436 KB
testcase_05 AC 80 ms
76,672 KB
testcase_06 AC 85 ms
76,032 KB
testcase_07 AC 82 ms
76,032 KB
testcase_08 AC 96 ms
76,376 KB
testcase_09 AC 37 ms
52,608 KB
testcase_10 AC 36 ms
52,096 KB
testcase_11 AC 86 ms
76,672 KB
testcase_12 AC 46 ms
62,080 KB
testcase_13 AC 82 ms
76,160 KB
testcase_14 AC 34 ms
52,736 KB
testcase_15 AC 33 ms
52,096 KB
testcase_16 AC 34 ms
52,608 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:
        print('No')
        exit()
    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