結果

問題 No.1219 Mancala Combo
ユーザー FromBooskaFromBooska
提出日時 2023-02-22 21:38:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 108,152 KB
最終ジャッジ日時 2023-09-30 04:19:49
合計ジャッジ時間 5,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,308 KB
testcase_01 AC 71 ms
71,440 KB
testcase_02 AC 71 ms
71,292 KB
testcase_03 AC 74 ms
71,380 KB
testcase_04 AC 88 ms
76,932 KB
testcase_05 AC 86 ms
76,948 KB
testcase_06 AC 78 ms
76,500 KB
testcase_07 AC 87 ms
77,088 KB
testcase_08 AC 82 ms
76,820 KB
testcase_09 AC 70 ms
71,324 KB
testcase_10 AC 69 ms
71,300 KB
testcase_11 AC 81 ms
76,948 KB
testcase_12 AC 80 ms
76,368 KB
testcase_13 AC 79 ms
76,532 KB
testcase_14 AC 74 ms
71,328 KB
testcase_15 AC 70 ms
71,444 KB
testcase_16 AC 70 ms
71,432 KB
testcase_17 AC 98 ms
97,260 KB
testcase_18 WA -
testcase_19 AC 95 ms
94,784 KB
testcase_20 WA -
testcase_21 AC 92 ms
92,176 KB
testcase_22 WA -
testcase_23 AC 104 ms
103,664 KB
testcase_24 WA -
testcase_25 AC 93 ms
94,420 KB
testcase_26 WA -
testcase_27 AC 108 ms
107,376 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

if N >= 320:
    if sum(A[:N//10]) < sumA:
        print('No')
        exit()
        
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