結果

問題 No.978 Fibonacci Convolution Easy
ユーザー vwxyzvwxyz
提出日時 2023-04-06 08:12:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 893 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 90,176 KB
最終ジャッジ日時 2024-04-10 07:19:47
合計ジャッジ時間 15,696 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
12,672 KB
testcase_01 AC 738 ms
42,320 KB
testcase_02 AC 366 ms
27,160 KB
testcase_03 AC 1,687 ms
86,972 KB
testcase_04 AC 508 ms
30,992 KB
testcase_05 AC 124 ms
15,744 KB
testcase_06 AC 601 ms
38,052 KB
testcase_07 AC 1,068 ms
60,588 KB
testcase_08 AC 746 ms
45,420 KB
testcase_09 AC 1,246 ms
67,756 KB
testcase_10 AC 1,682 ms
89,928 KB
testcase_11 AC 528 ms
34,040 KB
testcase_12 AC 121 ms
15,488 KB
testcase_13 AC 623 ms
37,672 KB
testcase_14 AC 197 ms
19,200 KB
testcase_15 AC 675 ms
41,316 KB
testcase_16 AC 1,696 ms
90,140 KB
testcase_17 AC 1,717 ms
90,176 KB
testcase_18 RE -
testcase_19 AC 39 ms
11,904 KB
testcase_20 AC 38 ms
11,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

N,P=map(int,readline().split())
mod=10**9+7
A=[None]*N
A[0]=0
A[1]=1
for i in range(2,N):
    A[i]=P*A[i-1]%mod+A[i-2]
    A[i]%=mod
ans=(sum(A)**2%mod+sum(a**2%mod for a in A))*(1+mod)//2%mod
print(ans)
0