結果

問題 No.1219 Mancala Combo
ユーザー FromBooskaFromBooska
提出日時 2023-02-22 21:52:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 120,008 KB
最終ジャッジ日時 2023-09-30 04:30:58
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,172 KB
testcase_01 AC 60 ms
71,184 KB
testcase_02 AC 59 ms
71,100 KB
testcase_03 AC 58 ms
71,236 KB
testcase_04 AC 62 ms
71,152 KB
testcase_05 AC 61 ms
71,312 KB
testcase_06 AC 58 ms
71,152 KB
testcase_07 AC 60 ms
70,932 KB
testcase_08 AC 64 ms
71,256 KB
testcase_09 AC 63 ms
71,100 KB
testcase_10 AC 60 ms
71,096 KB
testcase_11 AC 59 ms
71,012 KB
testcase_12 AC 60 ms
71,300 KB
testcase_13 AC 62 ms
71,316 KB
testcase_14 AC 61 ms
71,272 KB
testcase_15 AC 60 ms
71,212 KB
testcase_16 AC 59 ms
71,016 KB
testcase_17 AC 99 ms
105,664 KB
testcase_18 AC 97 ms
106,012 KB
testcase_19 AC 95 ms
101,880 KB
testcase_20 AC 102 ms
109,924 KB
testcase_21 AC 90 ms
98,776 KB
testcase_22 AC 99 ms
102,700 KB
testcase_23 AC 106 ms
114,176 KB
testcase_24 AC 89 ms
99,032 KB
testcase_25 AC 97 ms
102,172 KB
testcase_26 AC 98 ms
105,976 KB
testcase_27 AC 113 ms
120,008 KB
testcase_28 AC 114 ms
107,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 逆順ではなく問題通りの順番で考える
# Ai = iとなる最小のAiを崩していく、そうしないと上から降ってきてクリアできなくなる
# Ai = iとなる最小のAiを崩した後、Ai+1以後の合計が降ってくる
# その合計がiの倍数であれば順次クリアできるが、倍数でなければ結局クリアできない
# Aiを保っておくと考えれば、(Ai+以後合計)が倍数かどうかということになる

N = int(input())
A = list(map(int, input().split()))
temp = sum(A)
cum = []
for i in range(N):
    temp -= A[i]
    cum.append(temp)

#print(A)
#print(cum)

ans = 'Yes'
for i in range(N):
    if (A[i]+cum[i])%(i+1) != 0:
        ans = 'No'
print(ans)
0