結果

問題 No.2511 Mountain Sequence
ユーザー rlangevinrlangevin
提出日時 2024-02-15 12:33:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 84,836 KB
最終ジャッジ日時 2024-02-15 12:33:19
合計ジャッジ時間 4,686 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
67,392 KB
testcase_01 AC 50 ms
67,400 KB
testcase_02 AC 70 ms
81,060 KB
testcase_03 AC 52 ms
67,776 KB
testcase_04 AC 59 ms
74,860 KB
testcase_05 AC 60 ms
73,884 KB
testcase_06 AC 65 ms
80,676 KB
testcase_07 AC 65 ms
78,244 KB
testcase_08 AC 58 ms
71,040 KB
testcase_09 AC 52 ms
67,784 KB
testcase_10 AC 65 ms
80,292 KB
testcase_11 AC 74 ms
84,308 KB
testcase_12 AC 51 ms
67,400 KB
testcase_13 AC 69 ms
81,444 KB
testcase_14 AC 74 ms
84,628 KB
testcase_15 AC 74 ms
84,244 KB
testcase_16 AC 74 ms
83,740 KB
testcase_17 AC 70 ms
83,844 KB
testcase_18 AC 64 ms
80,292 KB
testcase_19 AC 68 ms
80,292 KB
testcase_20 AC 66 ms
80,292 KB
testcase_21 AC 71 ms
83,756 KB
testcase_22 AC 67 ms
80,548 KB
testcase_23 AC 60 ms
76,160 KB
testcase_24 AC 60 ms
76,160 KB
testcase_25 AC 76 ms
83,200 KB
testcase_26 AC 57 ms
74,112 KB
testcase_27 AC 65 ms
80,256 KB
testcase_28 AC 49 ms
67,400 KB
testcase_29 AC 64 ms
80,292 KB
testcase_30 AC 65 ms
80,292 KB
testcase_31 AC 65 ms
80,292 KB
testcase_32 AC 69 ms
81,444 KB
testcase_33 AC 75 ms
84,836 KB
testcase_34 AC 67 ms
80,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = 505050
mod = 998244353
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

def comb(n, r):
    if n < 0 or r < 0 or n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n - r] % mod


N, M = map(int, input().split())
ans = 0
for m in range(M + 1):
    ans += comb(2 * m - 2, N - 1)
    ans %= mod
    
print(ans)
0