結果

問題 No.1331 Moving Penguin
ユーザー roarisroaris
提出日時 2021-06-03 18:47:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 87,356 KB
実行使用メモリ 96,032 KB
最終ジャッジ日時 2023-08-10 20:11:45
合計ジャッジ時間 64,609 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
78,572 KB
testcase_01 AC 92 ms
72,148 KB
testcase_02 AC 85 ms
71,632 KB
testcase_03 AC 84 ms
72,004 KB
testcase_04 AC 1,412 ms
93,992 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,413 ms
95,760 KB
testcase_09 AC 1,460 ms
95,620 KB
testcase_10 AC 1,434 ms
95,632 KB
testcase_11 AC 1,403 ms
95,828 KB
testcase_12 AC 1,406 ms
95,920 KB
testcase_13 AC 1,390 ms
95,748 KB
testcase_14 AC 1,410 ms
95,816 KB
testcase_15 AC 1,413 ms
95,588 KB
testcase_16 AC 1,394 ms
95,804 KB
testcase_17 AC 1,417 ms
96,032 KB
testcase_18 AC 1,417 ms
95,760 KB
testcase_19 AC 1,417 ms
95,816 KB
testcase_20 AC 1,407 ms
95,768 KB
testcase_21 AC 1,406 ms
95,692 KB
testcase_22 AC 1,390 ms
96,032 KB
testcase_23 AC 1,381 ms
95,824 KB
testcase_24 AC 1,418 ms
95,700 KB
testcase_25 AC 1,399 ms
95,832 KB
testcase_26 AC 1,379 ms
93,216 KB
testcase_27 AC 1,387 ms
93,740 KB
testcase_28 AC 1,384 ms
93,324 KB
testcase_29 AC 1,390 ms
92,636 KB
testcase_30 AC 335 ms
81,516 KB
testcase_31 AC 645 ms
85,140 KB
testcase_32 AC 299 ms
81,072 KB
testcase_33 AC 544 ms
82,752 KB
testcase_34 AC 804 ms
88,280 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 AC 376 ms
81,700 KB
testcase_39 AC 1,377 ms
93,608 KB
testcase_40 AC 547 ms
84,188 KB
testcase_41 TLE -
testcase_42 AC 1,497 ms
93,000 KB
testcase_43 AC 1,489 ms
93,656 KB
testcase_44 AC 1,477 ms
93,172 KB
testcase_45 TLE -
testcase_46 AC 1,475 ms
93,124 KB
testcase_47 AC 1,488 ms
93,136 KB
testcase_48 AC 1,393 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
    else:
        acc[A[i]][(i+1)%A[i]] += dp[i]
        acc[A[i]][(i+1)%A[i]] %= MOD

print(dp[N-1])
0