結果

問題 No.444 旨味の相乗効果
ユーザー convexineqconvexineq
提出日時 2021-02-05 08:14:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,500 ms
コード長 449 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 76,552 KB
最終ジャッジ日時 2023-09-14 13:38:28
合計ジャッジ時間 4,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,044 KB
testcase_01 AC 71 ms
71,040 KB
testcase_02 AC 70 ms
71,288 KB
testcase_03 AC 71 ms
71,212 KB
testcase_04 AC 87 ms
76,432 KB
testcase_05 AC 72 ms
71,264 KB
testcase_06 AC 72 ms
71,188 KB
testcase_07 AC 80 ms
76,288 KB
testcase_08 AC 81 ms
76,236 KB
testcase_09 AC 74 ms
76,000 KB
testcase_10 AC 76 ms
75,936 KB
testcase_11 AC 76 ms
76,004 KB
testcase_12 AC 80 ms
76,224 KB
testcase_13 AC 81 ms
76,120 KB
testcase_14 AC 76 ms
75,904 KB
testcase_15 AC 72 ms
71,184 KB
testcase_16 AC 85 ms
76,552 KB
testcase_17 AC 71 ms
71,264 KB
testcase_18 AC 75 ms
76,084 KB
testcase_19 AC 81 ms
76,120 KB
testcase_20 AC 86 ms
76,520 KB
testcase_21 AC 69 ms
71,388 KB
testcase_22 AC 70 ms
71,288 KB
testcase_23 AC 73 ms
71,256 KB
testcase_24 AC 78 ms
76,196 KB
testcase_25 AC 72 ms
71,180 KB
testcase_26 AC 71 ms
71,296 KB
testcase_27 AC 77 ms
75,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def F(f,g):
    lf,lg = len(f),len(g)
    r = [0]*(lf+lg-1)
    for i in range(lf):
        for j in range(lg):
            r[i+j] = (r[i+j]+f[i]*g[j])%MOD
    return r

n,N,*a = map(int,open(0).read().split())
MOD = 10**9+7
f,g = [1],[1]
x = 0
for ai in a:
    g = F(g,[1,-ai])
    x -= pow(ai,N,MOD)
while N:
    h = g[:]
    for i in range(1,len(g),2): h[i] = -h[i]
    f = F(f,h)[N%2:N+1:2]
    g = F(g,h)[:N+1:2]
    N //= 2
print((x+f[0])%MOD)
0