結果

問題 No.1785 Inequality Signs
ユーザー minimumminimum
提出日時 2022-10-26 14:37:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,107 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 106,148 KB
最終ジャッジ日時 2023-09-17 07:35:45
合計ジャッジ時間 16,820 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
99,228 KB
testcase_01 AC 217 ms
100,800 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 242 ms
100,288 KB
testcase_28 AC 233 ms
100,180 KB
testcase_29 AC 236 ms
100,408 KB
testcase_30 AC 240 ms
100,252 KB
testcase_31 AC 232 ms
100,096 KB
testcase_32 AC 234 ms
100,236 KB
testcase_33 AC 209 ms
99,272 KB
testcase_34 AC 208 ms
99,800 KB
testcase_35 AC 210 ms
101,600 KB
testcase_36 AC 226 ms
100,240 KB
testcase_37 AC 224 ms
100,360 KB
testcase_38 AC 226 ms
100,344 KB
testcase_39 AC 230 ms
103,184 KB
testcase_40 AC 236 ms
102,332 KB
testcase_41 AC 239 ms
103,672 KB
testcase_42 AC 237 ms
100,040 KB
testcase_43 AC 245 ms
100,352 KB
testcase_44 AC 233 ms
100,244 KB
testcase_45 AC 225 ms
104,316 KB
testcase_46 AC 226 ms
100,512 KB
testcase_47 AC 232 ms
106,148 KB
testcase_48 AC 231 ms
104,152 KB
testcase_49 AC 209 ms
100,004 KB
testcase_50 AC 227 ms
100,340 KB
testcase_51 AC 210 ms
99,856 KB
testcase_52 AC 202 ms
99,628 KB
testcase_53 AC 210 ms
101,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Combination:

    def __init__(self, MX=10**6, MOD=998244353):
        self.MX = MX
        self.MOD = MOD
        self.fact = [1] * (MX + 1)
        self.inv = [1] * (MX + 1)
        self.f_inv = [1] * (MX + 1)
        for i in range(2, MX + 1):
            self.fact[i] = (self.fact[i - 1] * i) % MOD
            self.inv[i] = ( - (MOD // i) * (self.inv[MOD % i])) % MOD
            self.f_inv[i] = (self.f_inv[i - 1] * self.inv[i]) % MOD
    
    def invs(self, n):
        if n <= self.MX:
            return self.inv[n]
        else:
            return pow(n, self.MOD - 2, self.MOD)
    
    def p(self, n, r):
        if r > n or r < 0:
            return 0
        return (self.fact[n] * self.f_inv[r]) % self.MOD
    
    def c(self, n, r):
        if r > n or r < 0:
            return 0
        return (self.fact[n] * self.f_inv[r] * self.f_inv[n - r]) % self.MOD


MOD = 10 ** 9 + 7
com = Combination(MOD = MOD)
N, K = map(int, input().split())
ans = 0

for i in range(N):
    ans += com.c(N - 1, i) * com.c(K + N - 1 - i, N)
    ans %= MOD
    # print(i, com.c(N - 1, i), ans)

print(ans)
0