結果

問題 No.995 タピオカオイシクナーレ
ユーザー tktk_snsntktk_snsn
提出日時 2020-06-08 20:35:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 12,308 KB
最終ジャッジ日時 2023-08-27 02:09:12
合計ジャッジ時間 3,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,760 KB
testcase_01 AC 17 ms
7,828 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 16 ms
7,896 KB
testcase_04 AC 17 ms
7,768 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 16 ms
7,760 KB
testcase_07 AC 16 ms
7,772 KB
testcase_08 AC 16 ms
7,764 KB
testcase_09 AC 16 ms
7,876 KB
testcase_10 AC 16 ms
7,944 KB
testcase_11 AC 17 ms
7,940 KB
testcase_12 AC 17 ms
7,880 KB
testcase_13 AC 16 ms
7,784 KB
testcase_14 AC 16 ms
7,908 KB
testcase_15 AC 17 ms
7,968 KB
testcase_16 AC 78 ms
12,244 KB
testcase_17 AC 79 ms
12,244 KB
testcase_18 AC 78 ms
12,308 KB
testcase_19 AC 78 ms
12,240 KB
testcase_20 AC 76 ms
12,148 KB
testcase_21 AC 77 ms
12,180 KB
testcase_22 AC 77 ms
12,240 KB
testcase_23 AC 79 ms
12,080 KB
testcase_24 AC 79 ms
12,132 KB
testcase_25 AC 77 ms
12,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7

N, M, K, a, b = map(int, input().split())
B = [int(input()) for _ in range(N)]

p = a * pow(b, mod - 2, mod) % mod
q = (b - a) * pow(b, mod - 2, mod) % mod
warp1 = (1 + pow(q - p, K, mod)) * pow(2, mod - 2, mod) % mod
warp2 = (1 - pow(q - p, K, mod) + mod) * pow(2, mod - 2, mod) % mod

ans = 0
for i in range(M):
    ans += B[i] * warp1
    ans %= mod

for i in range(M, N):
    ans += B[i] * warp2
    ans %= mod

print(ans)
0