結果

問題 No.1331 Moving Penguin
ユーザー roarisroaris
提出日時 2021-06-03 18:44:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 114,696 KB
最終ジャッジ日時 2023-08-10 20:07:38
合計ジャッジ時間 52,025 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
78,700 KB
testcase_01 AC 89 ms
72,192 KB
testcase_02 AC 89 ms
72,232 KB
testcase_03 AC 89 ms
72,252 KB
testcase_04 AC 1,486 ms
114,696 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,471 ms
95,888 KB
testcase_09 AC 1,478 ms
95,680 KB
testcase_10 AC 1,477 ms
95,932 KB
testcase_11 AC 1,485 ms
96,000 KB
testcase_12 AC 1,489 ms
95,920 KB
testcase_13 AC 1,476 ms
95,760 KB
testcase_14 AC 1,492 ms
95,916 KB
testcase_15 AC 1,483 ms
95,752 KB
testcase_16 AC 1,488 ms
95,840 KB
testcase_17 AC 1,481 ms
95,888 KB
testcase_18 AC 1,492 ms
95,764 KB
testcase_19 AC 1,483 ms
95,768 KB
testcase_20 AC 1,490 ms
96,148 KB
testcase_21 AC 1,465 ms
95,708 KB
testcase_22 TLE -
testcase_23 AC 1,483 ms
95,776 KB
testcase_24 AC 1,474 ms
95,916 KB
testcase_25 AC 1,480 ms
95,776 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 AC 1,493 ms
101,868 KB
testcase_30 AC 392 ms
85,716 KB
testcase_31 AC 718 ms
88,072 KB
testcase_32 AC 350 ms
84,564 KB
testcase_33 AC 618 ms
87,632 KB
testcase_34 AC 884 ms
90,432 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 AC 442 ms
85,624 KB
testcase_39 AC 1,482 ms
101,016 KB
testcase_40 AC 617 ms
87,784 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 AC 1,489 ms
95,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
M = int(N**0.5)
dp = [0]*N
dp[0] = 1
acc = defaultdict(lambda: defaultdict(int))
MOD = 10**9+7

for i in range(N):
    if i>0 and A[i-1]>1:
        dp[i] += dp[i-1]
        dp[i] %= MOD
        
    for j in range(1, M):
        dp[i] += acc[j][(i+1)%j]
        dp[i] %= MOD
    
    if A[i]>=M:
        for j in range(i+A[i], N, A[i]):
            dp[j] += dp[i]
            dp[j] %= MOD
    
    acc[A[i]][(i+1)%A[i]] += dp[i]
    acc[A[i]][(i+1)%A[i]] %= MOD

print(dp[N-1])
0