結果

問題 No.980 Fibonacci Convolution Hard
ユーザー titiatitia
提出日時 2020-02-28 06:17:15
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 381 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 94,520 KB
最終ジャッジ日時 2023-08-03 19:12:07
合計ジャッジ時間 39,840 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 1,877 ms
94,436 KB
testcase_02 AC 1,859 ms
94,380 KB
testcase_03 AC 1,869 ms
94,384 KB
testcase_04 AC 1,881 ms
94,440 KB
testcase_05 AC 1,861 ms
94,436 KB
testcase_06 AC 1,982 ms
94,400 KB
testcase_07 TLE -
testcase_08 AC 1,994 ms
94,520 KB
testcase_09 AC 1,872 ms
94,488 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,979 ms
94,492 KB
testcase_14 AC 1,866 ms
94,384 KB
testcase_15 AC 1,862 ms
94,324 KB
testcase_16 AC 1,562 ms
94,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
mod=1000000007

p=int(input())
q=int(input())
Q=[int(input()) for i in range(q)]

ANS=[0,0,0,0]

A=[0,1]
A.append(p*A[-1]+A[-2])
A.append(p*A[-1]+A[-2])

ANS[2]=A[0]*A[2]*2+A[1]*A[1]
ANS[3]=A[0]*A[3]*2+A[1]*A[2]*2

for i in range(2*10**6):
    ANS.append((2*p*ANS[-1]-(p**2-2)*ANS[-2]-2*p*ANS[-3]-ANS[-4])%mod)

for q in Q:
    print(ANS[q-2])
0