結果

問題 No.2199 lower_bound and upper_bound
ユーザー tassei903tassei903
提出日時 2023-01-20 23:40:58
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,034 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,372 KB
実行使用メモリ 79,792 KB
最終ジャッジ日時 2023-09-05 16:07:47
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,084 KB
testcase_01 AC 74 ms
71,016 KB
testcase_02 RE -
testcase_03 AC 71 ms
71,036 KB
testcase_04 AC 73 ms
71,156 KB
testcase_05 AC 73 ms
70,836 KB
testcase_06 AC 74 ms
70,832 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n,l,r = na()
mod = 998244353
nn = n + 10
fact = [1] * nn
for i in range(nn - 1):
    fact[i + 1] = fact[i] * (i + 1) % mod
invfact = [1] * nn
invfact[nn - 1] = pow(fact[nn - 1], mod - 2, mod)
for i in range(nn - 1)[::-1]:
    invfact[i] = invfact[i + 1] * (i + 1) % mod
 
def binom(x, y):
    if x < 0 or y < 0 or x - y < 0:
        return 0
    return fact[x] * invfact[y] % mod * invfact[x - y] % mod


ans = 0
for i in range(r-l+1):
    tx,ty = n, r-i+n
    sx,sy = 1, 0
    ssx, ssy = -r-1, r+2
    #print(tx-sx,ty-sy,tx-ssx, ty-ssy,binom(ty-sy+tx-sx,tx-sx),binom(ty-ssy+tx-ssx,tx-ssx))
    ans += binom(ty-sy+tx-sx,tx-sx)-binom(ty-ssy+tx-ssx,tx-ssx)
    ans %= mod
print(ans)
0