結果
問題 |
No.1219 Mancala Combo
|
ユーザー |
![]() |
提出日時 | 2023-02-22 17:33:36 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 786 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 242,152 KB |
最終ジャッジ日時 | 2024-07-22 18:56:17 |
合計ジャッジ時間 | 4,914 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 TLE * 1 -- * 11 |
ソースコード
# 和は不変量 # 終了時には全部=和が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)