結果

問題 No.2199 lower_bound and upper_bound
ユーザー titiatitia
提出日時 2023-01-26 02:01:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 439 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 47,516 KB
最終ジャッジ日時 2023-09-09 09:06:46
合計ジャッジ時間 9,853 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 295 ms
47,332 KB
testcase_01 AC 297 ms
47,416 KB
testcase_02 AC 305 ms
47,464 KB
testcase_03 AC 303 ms
47,408 KB
testcase_04 AC 310 ms
47,344 KB
testcase_05 AC 306 ms
47,516 KB
testcase_06 AC 298 ms
47,416 KB
testcase_07 AC 298 ms
47,280 KB
testcase_08 AC 302 ms
47,328 KB
testcase_09 AC 295 ms
47,280 KB
testcase_10 AC 401 ms
47,472 KB
testcase_11 AC 295 ms
47,480 KB
testcase_12 AC 297 ms
47,412 KB
testcase_13 AC 439 ms
47,472 KB
testcase_14 AC 295 ms
47,280 KB
testcase_15 AC 295 ms
47,508 KB
testcase_16 AC 320 ms
47,336 KB
testcase_17 AC 321 ms
47,476 KB
testcase_18 AC 343 ms
47,332 KB
testcase_19 AC 395 ms
47,404 KB
testcase_20 AC 383 ms
47,420 KB
testcase_21 AC 350 ms
47,284 KB
testcase_22 AC 329 ms
47,284 KB
testcase_23 AC 361 ms
47,276 KB
testcase_24 AC 364 ms
47,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,L,U=map(int,input().split())

mod=998244353

FACT=[1]
for i in range(1,5*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(5*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0
k=U+1
ANS=0
for i in range(L,U+1):
    M=i+N
    ANS+=Combi(M+N-1,N-1)
    ANS-=Combi(N-1+M,N+k)
    ANS%=mod

print(ANS%mod)
0