結果

問題 No.2033 Chromatic Duel
ユーザー gew1fw
提出日時 2025-06-12 21:40:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 75,044 KB
最終ジャッジ日時 2025-06-12 21:44:16
合計ジャッジ時間 3,308 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 7 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

def main():
    import sys
    N, B, W = map(int, sys.stdin.readline().split())
    K = N - W
    if K < B:
        print(0)
        return
    if (K - B) % 2 != 0:
        print(0)
        return
    t = (K - B) // 2
    if t < 1:
        print(0)
        return
    
    from math import comb
    if B < t:
        print(0)
        return
    ways = comb(B-1, t-1)
    
    total_occupied = K + (t - 1)
    if total_occupied > N:
        print(0)
        return
    
    available = N - total_occupied
    ways *= comb(available + t, t)
    ways %= MOD
    print(ways % MOD)

if __name__ == '__main__':
    main()
0