結果

問題 No.1219 Mancala Combo
ユーザー FromBooskaFromBooska
提出日時 2023-02-22 17:33:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 786 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 245,156 KB
最終ジャッジ日時 2023-09-30 00:59:44
合計ジャッジ時間 5,966 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,900 KB
testcase_01 AC 70 ms
71,264 KB
testcase_02 AC 69 ms
71,524 KB
testcase_03 AC 69 ms
71,540 KB
testcase_04 AC 96 ms
76,764 KB
testcase_05 AC 83 ms
76,988 KB
testcase_06 AC 77 ms
76,480 KB
testcase_07 AC 84 ms
76,852 KB
testcase_08 AC 80 ms
76,912 KB
testcase_09 AC 68 ms
71,436 KB
testcase_10 AC 69 ms
71,156 KB
testcase_11 AC 80 ms
76,656 KB
testcase_12 AC 75 ms
76,548 KB
testcase_13 AC 78 ms
76,252 KB
testcase_14 AC 70 ms
71,572 KB
testcase_15 AC 70 ms
71,540 KB
testcase_16 AC 68 ms
71,344 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 #

# 和は不変量
# 終了時には全部=和が0にある
# そこから逆算すると一意に動きが決まる
# ++++0となる最初のゼロのところしか動かせない
# 0に和があるところから始めてAになればYes

N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
counts = [0]*(N+1)
counts[0] = sumA

#print(counts)

ans = 'No'
while True:
    found = False
    for i in range(0, N+1):
        if counts[i] != 0:
            counts[i] -= 1
        elif counts[i] == 0:
            if i == 0:
                break
            else:
                found = True
                counts[i] = i
                break
    #print(counts)
    if counts == [0]+A:
        ans = 'Yes'
        break
    if found == False:
        break
print(ans)


0