結果

問題 No.997 Jumping Kangaroo
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-04-16 11:15:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 76,252 KB
最終ジャッジ日時 2023-08-26 16:57:03
合計ジャッジ時間 4,270 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,300 KB
testcase_01 AC 69 ms
71,164 KB
testcase_02 AC 70 ms
71,400 KB
testcase_03 AC 69 ms
70,964 KB
testcase_04 AC 69 ms
71,308 KB
testcase_05 AC 69 ms
71,400 KB
testcase_06 AC 68 ms
71,276 KB
testcase_07 AC 68 ms
71,508 KB
testcase_08 AC 70 ms
71,164 KB
testcase_09 AC 69 ms
71,452 KB
testcase_10 AC 69 ms
71,120 KB
testcase_11 AC 68 ms
71,268 KB
testcase_12 AC 68 ms
71,176 KB
testcase_13 AC 70 ms
71,284 KB
testcase_14 AC 69 ms
71,120 KB
testcase_15 AC 68 ms
71,152 KB
testcase_16 AC 74 ms
76,136 KB
testcase_17 AC 71 ms
71,280 KB
testcase_18 AC 75 ms
75,708 KB
testcase_19 AC 73 ms
71,428 KB
testcase_20 AC 77 ms
76,252 KB
testcase_21 AC 71 ms
70,964 KB
testcase_22 AC 75 ms
76,080 KB
testcase_23 AC 75 ms
76,108 KB
testcase_24 AC 70 ms
71,072 KB
testcase_25 AC 71 ms
71,184 KB
testcase_26 AC 71 ms
71,264 KB
testcase_27 AC 70 ms
71,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w,k= map(int,input().split())
A = list(map(int,input().split()))
mod = 10**9+7


def calc(x,y):
    ans = [[0]*2 for i in range(2)]
    for i in range(2):
        for j in range(2):
            for t in range(2):
                ans[i][j] += x[i][t]*y[t][j]
                ans[i][j] %= mod
    return ans


dp = [0]*(w*2+1)
dp[0] = 1
for i in range(w*2+1):
    for a in A:
        if i + a <= 2*w:
            dp[i+a] += dp[i]
            dp[i+a] %= mod
base = [[1,0],[0,1]]
A = [[dp[w],(dp[-1]-dp[w]**2)%mod],[1,0]]

while k:
    if k & 1:
        base = calc(A,base)
    k >>= 1
    A = calc(A,A)

print(base[0][0])
0