結果

問題 No.1331 Moving Penguin
ユーザー mkawa2mkawa2
提出日時 2021-01-08 22:14:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,211 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 82,204 KB
実行使用メモリ 89,752 KB
最終ジャッジ日時 2024-04-28 03:28:46
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 38 ms
53,232 KB
testcase_02 AC 32 ms
53,424 KB
testcase_03 AC 35 ms
52,724 KB
testcase_04 RE -
testcase_05 AC 292 ms
89,324 KB
testcase_06 AC 285 ms
89,640 KB
testcase_07 AC 280 ms
89,304 KB
testcase_08 AC 74 ms
89,104 KB
testcase_09 AC 70 ms
89,220 KB
testcase_10 AC 72 ms
89,032 KB
testcase_11 AC 72 ms
89,640 KB
testcase_12 AC 73 ms
89,512 KB
testcase_13 AC 76 ms
89,212 KB
testcase_14 AC 88 ms
88,956 KB
testcase_15 AC 91 ms
89,216 KB
testcase_16 AC 87 ms
89,448 KB
testcase_17 AC 76 ms
89,080 KB
testcase_18 AC 71 ms
89,440 KB
testcase_19 AC 72 ms
89,096 KB
testcase_20 AC 72 ms
89,524 KB
testcase_21 AC 72 ms
89,496 KB
testcase_22 AC 71 ms
89,752 KB
testcase_23 AC 78 ms
89,212 KB
testcase_24 AC 78 ms
89,580 KB
testcase_25 AC 76 ms
89,436 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 AC 59 ms
83,096 KB
権限があれば一括ダウンロードができます

ソースコード

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
    fin.add(a)
    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