結果

問題 No.2409 Strange Werewolves
ユーザー flygonflygon
提出日時 2023-08-11 21:36:29
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 834 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 131,584 KB
最終ジャッジ日時 2024-04-29 12:26:52
合計ジャッジ時間 3,359 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
124,928 KB
testcase_01 AC 131 ms
124,928 KB
testcase_02 AC 130 ms
125,376 KB
testcase_03 RE -
testcase_04 AC 126 ms
125,056 KB
testcase_05 AC 124 ms
125,440 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 124 ms
125,440 KB
testcase_09 AC 126 ms
124,928 KB
testcase_10 AC 125 ms
125,440 KB
testcase_11 AC 125 ms
125,568 KB
testcase_12 AC 126 ms
125,184 KB
testcase_13 AC 126 ms
124,800 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 125 ms
125,056 KB
testcase_17 AC 125 ms
125,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

mod = 998244353
# nCk
def com(n, mod):
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    for i in range(2, n+1):
        fact.append((fact[-1]*i) % mod)
        inv.append((-inv[mod % i]*(mod//i)) % mod)
        factinv.append((factinv[-1]*inv[-1]) % mod)
    return fact, factinv


f,fi = com(3*10**5+10, mod)

def npr(n, r,):
    return f[n] * fi[n-r] % mod
def ncr(n, r):
    return f[n] * fi[n-r] % mod * fi[r] % mod

x,y,z,w = map(int,input().split())

if w == 0:
    print(npr(x,x-z)*npr(y,y-w)%mod*ncr(x+y-(w+z)-1, x-z)%mod)
else:
    print(npr(x,x-z)*npr(y,y-w)%mod*ncr(x+y-(w+z)-1, y-w)%mod)
0