結果

問題 No.997 Jumping Kangaroo
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-02-21 23:48:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 543 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,480 KB
最終ジャッジ日時 2024-04-17 09:36:23
合計ジャッジ時間 16,779 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 526 ms
43,960 KB
testcase_01 AC 525 ms
43,828 KB
testcase_02 AC 523 ms
43,832 KB
testcase_03 AC 531 ms
43,708 KB
testcase_04 AC 524 ms
44,092 KB
testcase_05 AC 522 ms
43,836 KB
testcase_06 AC 536 ms
44,092 KB
testcase_07 AC 534 ms
44,136 KB
testcase_08 AC 526 ms
43,968 KB
testcase_09 AC 526 ms
43,716 KB
testcase_10 AC 525 ms
44,212 KB
testcase_11 AC 526 ms
44,220 KB
testcase_12 AC 529 ms
43,840 KB
testcase_13 AC 541 ms
43,956 KB
testcase_14 AC 536 ms
44,088 KB
testcase_15 AC 535 ms
43,836 KB
testcase_16 AC 528 ms
44,212 KB
testcase_17 AC 527 ms
43,964 KB
testcase_18 AC 525 ms
43,964 KB
testcase_19 AC 528 ms
43,956 KB
testcase_20 AC 539 ms
43,832 KB
testcase_21 AC 530 ms
44,216 KB
testcase_22 AC 537 ms
43,840 KB
testcase_23 AC 535 ms
44,092 KB
testcase_24 AC 537 ms
44,480 KB
testcase_25 AC 534 ms
43,712 KB
testcase_26 AC 537 ms
44,224 KB
testcase_27 AC 543 ms
44,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
mod = 10**9+7
N, W, K = map(int, input().split())
A = list(map(int, input().split()))
dp = [0]*(2*W+1)
dp[0] = 1
for i in range(1, 2*W+1):
    for a in A:
        if i >= a:
            dp[i] += dp[i-a]
    dp[i] %= mod
a = dp[W]
b = (dp[2*W] - dp[W]*dp[W])%mod
#print(a, b)
X = [[b, a],[b*a, a**2+b]]
#X = [[1, 0],[1, 0]]
X = np.array(X, dtype="object")
S = [1, a]
S = np.array(S, dtype="object")
#print(S)
#print("aa", np.dot(X, S))

tmp = K%2
K //= 2
for _ in range(60):
    if K%2:
        S = np.dot(X, S)%mod
    K = K//2
    X = np.dot(X, X)%mod
#print(S)
print(S[tmp])
0