結果

問題 No.1489 Repeat Cumulative Sum
ユーザー rlangevinrlangevin
提出日時 2023-11-19 13:08:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,640 KB
最終ジャッジ日時 2023-11-19 13:08:34
合計ジャッジ時間 6,836 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 140 ms
87,572 KB
testcase_04 AC 129 ms
86,040 KB
testcase_05 AC 138 ms
87,620 KB
testcase_06 AC 122 ms
84,864 KB
testcase_07 AC 99 ms
81,200 KB
testcase_08 AC 77 ms
75,312 KB
testcase_09 AC 151 ms
89,624 KB
testcase_10 AC 137 ms
87,584 KB
testcase_11 AC 122 ms
84,884 KB
testcase_12 AC 54 ms
64,448 KB
testcase_13 AC 115 ms
83,900 KB
testcase_14 AC 185 ms
91,484 KB
testcase_15 AC 155 ms
91,268 KB
testcase_16 AC 104 ms
82,156 KB
testcase_17 AC 111 ms
83,324 KB
testcase_18 AC 97 ms
81,228 KB
testcase_19 AC 76 ms
75,268 KB
testcase_20 AC 89 ms
79,648 KB
testcase_21 AC 123 ms
84,852 KB
testcase_22 AC 54 ms
64,416 KB
testcase_23 AC 68 ms
70,212 KB
testcase_24 AC 37 ms
53,460 KB
testcase_25 AC 63 ms
68,816 KB
testcase_26 AC 162 ms
91,640 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
N -= 1
A = list(map(int, input().split())) + [0]
mod = 10**9 + 7
comb = 1
inv = 1
for i in range(1, N + 1):
    comb *= M + i
    inv *= i
    comb %= mod
    inv %= mod
    
inv = pow(inv, mod - 2, mod)
comb = comb * inv % mod
ans = 0
for i in range(N):
    ans += (A[i] - A[i - 1]) * (comb - 1)
    ans %= mod
    comb *= (N - i) * pow(N + M - i, mod - 2, mod)
    comb %= mod
    
print(ans)
0