結果

問題 No.1331 Moving Penguin
ユーザー roarisroaris
提出日時 2021-06-03 18:47:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 91,780 KB
最終ジャッジ日時 2024-04-28 13:27:00
合計ジャッジ時間 47,920 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
69,648 KB
testcase_01 AC 44 ms
54,204 KB
testcase_02 AC 43 ms
54,940 KB
testcase_03 AC 39 ms
53,944 KB
testcase_04 AC 1,409 ms
91,168 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,410 ms
90,792 KB
testcase_09 AC 1,414 ms
91,028 KB
testcase_10 AC 1,410 ms
91,116 KB
testcase_11 AC 1,407 ms
91,128 KB
testcase_12 AC 1,401 ms
90,708 KB
testcase_13 AC 1,391 ms
91,004 KB
testcase_14 AC 1,414 ms
90,660 KB
testcase_15 AC 1,420 ms
90,836 KB
testcase_16 AC 1,448 ms
91,096 KB
testcase_17 AC 1,396 ms
90,592 KB
testcase_18 AC 1,420 ms
91,112 KB
testcase_19 AC 1,395 ms
90,740 KB
testcase_20 AC 1,414 ms
90,856 KB
testcase_21 AC 1,389 ms
90,928 KB
testcase_22 AC 1,417 ms
90,792 KB
testcase_23 AC 1,428 ms
91,020 KB
testcase_24 AC 1,401 ms
90,860 KB
testcase_25 AC 1,411 ms
90,824 KB
testcase_26 AC 1,436 ms
91,244 KB
testcase_27 AC 1,447 ms
91,224 KB
testcase_28 AC 1,458 ms
91,400 KB
testcase_29 AC 1,388 ms
91,728 KB
testcase_30 AC 327 ms
80,188 KB
testcase_31 AC 627 ms
83,816 KB
testcase_32 AC 277 ms
77,380 KB
testcase_33 AC 537 ms
82,008 KB
testcase_34 AC 807 ms
86,304 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 AC 351 ms
80,860 KB
testcase_39 AC 1,411 ms
91,684 KB
testcase_40 AC 537 ms
83,440 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,409 ms
91,056 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