結果

問題 No.2409 Strange Werewolves
ユーザー mattu34mattu34
提出日時 2023-09-05 00:30:15
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 576 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 87,344 KB
実行使用メモリ 843,676 KB
最終ジャッジ日時 2023-09-05 00:30:19
合計ジャッジ時間 3,762 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
71,712 KB
testcase_01 AC 207 ms
99,772 KB
testcase_02 AC 96 ms
71,740 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import heapq
import bisect

INF = float("inf")
MOD = 998244353

X, Y, Z, W = map(int, input().split())
N = X - Z + Y - W
dp = [[0] * (X + 1) for _ in range(N + 1)]
dp[0][X] = 1
for i in range(N):
    for x in range(X + 1):
        if i + 1 != N and x == 0:
            continue
        if not (i + 1 != N and x + 1 == 1) and x + 1 <= X:
            dp[i + 1][x] += dp[i][x + 1] * (x + 1)
        if not (i + 1 != N and Y - i + X - x == 1):
            dp[i + 1][x] += dp[i][x] * (Y - i + X - x)
        dp[i + 1][x] %= MOD
# print(dp)
print(dp[N][Z])
0