結果

問題 No.1331 Moving Penguin
ユーザー mkawa2mkawa2
提出日時 2021-01-08 22:15:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,215 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 95,584 KB
最終ジャッジ日時 2024-04-28 03:29:24
合計ジャッジ時間 6,902 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
52,096 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 41 ms
52,224 KB
testcase_04 AC 79 ms
81,408 KB
testcase_05 AC 327 ms
89,796 KB
testcase_06 AC 325 ms
89,472 KB
testcase_07 AC 319 ms
89,048 KB
testcase_08 AC 84 ms
89,216 KB
testcase_09 AC 82 ms
89,344 KB
testcase_10 AC 82 ms
89,216 KB
testcase_11 AC 84 ms
89,676 KB
testcase_12 AC 83 ms
89,216 KB
testcase_13 AC 83 ms
89,132 KB
testcase_14 AC 102 ms
88,960 KB
testcase_15 AC 100 ms
89,312 KB
testcase_16 AC 101 ms
89,448 KB
testcase_17 AC 85 ms
89,536 KB
testcase_18 AC 85 ms
89,344 KB
testcase_19 AC 83 ms
89,600 KB
testcase_20 AC 84 ms
89,752 KB
testcase_21 AC 83 ms
89,472 KB
testcase_22 AC 91 ms
89,600 KB
testcase_23 AC 98 ms
89,088 KB
testcase_24 AC 98 ms
89,220 KB
testcase_25 AC 101 ms
89,344 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)]
fin=set()
for i, a in enumerate(aa):
    for m in fin:
        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:
        fin.add(a)
        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