結果

問題 No.1785 Inequality Signs
ユーザー rlangevinrlangevin
提出日時 2023-04-30 15:35:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 79,104 KB
最終ジャッジ日時 2024-04-29 22:11:26
合計ジャッジ時間 10,031 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
61,568 KB
testcase_01 AC 98 ms
78,720 KB
testcase_02 AC 196 ms
78,904 KB
testcase_03 AC 243 ms
78,844 KB
testcase_04 AC 56 ms
65,792 KB
testcase_05 AC 137 ms
78,720 KB
testcase_06 AC 223 ms
78,720 KB
testcase_07 AC 60 ms
67,072 KB
testcase_08 AC 215 ms
79,104 KB
testcase_09 AC 86 ms
77,056 KB
testcase_10 AC 173 ms
78,720 KB
testcase_11 AC 96 ms
78,592 KB
testcase_12 AC 126 ms
78,976 KB
testcase_13 AC 83 ms
75,904 KB
testcase_14 AC 147 ms
78,944 KB
testcase_15 AC 131 ms
78,720 KB
testcase_16 AC 113 ms
78,788 KB
testcase_17 AC 178 ms
79,064 KB
testcase_18 AC 179 ms
78,788 KB
testcase_19 AC 151 ms
78,800 KB
testcase_20 AC 165 ms
78,848 KB
testcase_21 AC 156 ms
78,848 KB
testcase_22 AC 94 ms
78,720 KB
testcase_23 AC 113 ms
78,848 KB
testcase_24 AC 244 ms
78,928 KB
testcase_25 AC 132 ms
78,848 KB
testcase_26 AC 129 ms
78,848 KB
testcase_27 AC 253 ms
78,800 KB
testcase_28 AC 250 ms
78,720 KB
testcase_29 AC 253 ms
78,968 KB
testcase_30 AC 257 ms
78,848 KB
testcase_31 AC 254 ms
78,856 KB
testcase_32 AC 254 ms
78,788 KB
testcase_33 AC 50 ms
61,824 KB
testcase_34 AC 67 ms
68,992 KB
testcase_35 AC 82 ms
72,192 KB
testcase_36 AC 210 ms
78,976 KB
testcase_37 AC 217 ms
78,800 KB
testcase_38 AC 193 ms
78,720 KB
testcase_39 AC 102 ms
78,952 KB
testcase_40 AC 120 ms
78,848 KB
testcase_41 AC 154 ms
78,720 KB
testcase_42 AC 234 ms
78,848 KB
testcase_43 AC 241 ms
78,720 KB
testcase_44 AC 224 ms
78,848 KB
testcase_45 AC 116 ms
78,592 KB
testcase_46 AC 191 ms
78,848 KB
testcase_47 AC 140 ms
78,976 KB
testcase_48 AC 170 ms
78,720 KB
testcase_49 AC 64 ms
67,584 KB
testcase_50 AC 213 ms
78,720 KB
testcase_51 AC 72 ms
71,296 KB
testcase_52 AC 66 ms
69,120 KB
testcase_53 AC 80 ms
74,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
mod = 10 ** 9 + 7

n = 202020

fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n):
    fact[i + 1] = ((i+1) * fact[i]) % mod
invfact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % mod
    
now = K + N - 1
val = 1
for i in range(N):
    val *= now - i
    val %= mod
    
ans = 0
inv = pow(N, mod - 2, mod)
for m in range(N):
    ans += inv * invfact[m] * invfact[N - 1 - m] * val
    ans %= mod
    val *= pow(now, mod - 2, mod)
    val *= now - N
    val %= mod
    now -= 1
    
print(ans)
0