結果

問題 No.2409 Strange Werewolves
ユーザー ニックネームニックネーム
提出日時 2023-08-11 21:40:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 57,728 KB
最終ジャッジ日時 2024-04-29 12:31:09
合計ジャッジ時間 5,613 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 489 ms
57,728 KB
testcase_04 AC 504 ms
57,728 KB
testcase_05 AC 271 ms
34,176 KB
testcase_06 AC 475 ms
57,728 KB
testcase_07 AC 523 ms
57,728 KB
testcase_08 AC 267 ms
36,096 KB
testcase_09 AC 303 ms
38,528 KB
testcase_10 AC 184 ms
23,808 KB
testcase_11 AC 58 ms
13,440 KB
testcase_12 AC 155 ms
24,320 KB
testcase_13 AC 259 ms
35,584 KB
testcase_14 AC 325 ms
40,192 KB
testcase_15 AC 337 ms
37,888 KB
testcase_16 AC 245 ms
32,896 KB
testcase_17 AC 58 ms
13,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y,z,w = map(int,input().split())
nmax = x+y; mod = 998244353; fa = [1]*(nmax+1); fi = [1]*(nmax+1)
for i in range(1,nmax): fa[i+1] = fa[i]*(i+1)%mod
fi[nmax] = pow(fa[nmax],mod-2,mod)
def cmb(n,r): return fa[n]*fi[n-r]%mod*fi[r]%mod if 0<=r<=n else 0
for i in range(nmax,0,-1): fi[i-1] = fi[i]*i%mod
if z==0: x,y,z,w = y,x,w,z
print(cmb(x,z)*y*fa[x+y-z-1]%mod)
0