結果

問題 No.1331 Moving Penguin
ユーザー mkawa2mkawa2
提出日時 2021-01-08 22:09:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,196 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 91,264 KB
最終ジャッジ日時 2024-04-28 03:20:59
合計ジャッジ時間 9,555 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 35 ms
52,096 KB
testcase_02 AC 33 ms
52,352 KB
testcase_03 AC 35 ms
52,352 KB
testcase_04 AC 238 ms
89,600 KB
testcase_05 AC 242 ms
85,632 KB
testcase_06 AC 244 ms
86,016 KB
testcase_07 AC 248 ms
85,632 KB
testcase_08 AC 232 ms
84,864 KB
testcase_09 AC 234 ms
84,992 KB
testcase_10 AC 231 ms
84,864 KB
testcase_11 AC 233 ms
84,992 KB
testcase_12 AC 230 ms
84,608 KB
testcase_13 AC 234 ms
84,864 KB
testcase_14 AC 238 ms
84,480 KB
testcase_15 AC 237 ms
84,864 KB
testcase_16 AC 233 ms
84,608 KB
testcase_17 AC 238 ms
85,888 KB
testcase_18 AC 236 ms
86,016 KB
testcase_19 AC 238 ms
85,760 KB
testcase_20 AC 238 ms
85,632 KB
testcase_21 AC 244 ms
85,632 KB
testcase_22 AC 277 ms
85,632 KB
testcase_23 AC 274 ms
84,864 KB
testcase_24 AC 235 ms
84,736 KB
testcase_25 AC 253 ms
84,864 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def MI1(): return map(int1, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [[(-1, 0), (1, 0)], [(0, -1), (0, 1)]]
inf = 10**16
# md = 998244353
md = 10**9+7

n = II()
aa = LI()
dp = [0]*(n+1)
dp[0] = 1
bb = [[0]*101 for _ in range(101)]
for i, a in enumerate(aa):
    for m in range(1, 101):
        dp[i] += bb[m][i%m]
        dp[i] %= md
    pre = dp[i]
    if pre == 0: continue
    if a > 100:
        for j in range(i+a, n+1):
            dp[j] += pre
            dp[j] %= md
    else:
        bb[a][i%a] += pre
        bb[a][i%a] %= md
    if a > 1:
        dp[i+1] += pre
        dp[i+1] %= md

print(dp[n-1]%md)
0