結果

問題 No.1102 Remnants
ユーザー Kiri8128Kiri8128
提出日時 2020-07-03 21:40:33
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 488 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 104,708 KB
最終ジャッジ日時 2023-10-16 23:42:45
合計ジャッジ時間 3,730 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
71,220 KB
testcase_01 AC 52 ms
71,220 KB
testcase_02 AC 53 ms
71,220 KB
testcase_03 AC 53 ms
71,220 KB
testcase_04 AC 53 ms
71,220 KB
testcase_05 RE -
testcase_06 AC 61 ms
77,196 KB
testcase_07 RE -
testcase_08 AC 58 ms
73,536 KB
testcase_09 AC 57 ms
73,536 KB
testcase_10 AC 56 ms
73,536 KB
testcase_11 AC 56 ms
73,536 KB
testcase_12 AC 56 ms
73,536 KB
testcase_13 AC 57 ms
73,536 KB
testcase_14 AC 70 ms
85,052 KB
testcase_15 AC 67 ms
83,144 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 65 ms
82,968 KB
testcase_20 AC 59 ms
76,196 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 71 ms
87,048 KB
testcase_25 RE -
testcase_26 AC 57 ms
73,536 KB
testcase_27 AC 62 ms
81,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

nn = 2 * 10 ** 5
P = 10 ** 9 + 7

fa = [1] * (nn+1)
fainv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % P
fainv[-1] = pow(fa[-1], P-2, P)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % P

N, K = map(int, input().split())
A = [int(a) for a in input().split()]

X = [1]
for i in range(1, 100100):
    X.append(X[-1] * (K + i) % P * fainv[i] % P * fa[i-1] % P)

ans = 0
for i, a in enumerate(A):
    ans = (ans + a * X[i] % P* X[N - i - 1]) % P

print(ans)
0