結果

問題 No.2528 pop_(backfront or not)
ユーザー mattu34mattu34
提出日時 2023-11-04 16:28:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 201,540 KB
最終ジャッジ日時 2023-11-04 16:28:54
合計ジャッジ時間 4,453 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,592 KB
testcase_01 AC 38 ms
53,592 KB
testcase_02 AC 37 ms
53,592 KB
testcase_03 AC 37 ms
53,592 KB
testcase_04 AC 39 ms
53,592 KB
testcase_05 AC 48 ms
62,008 KB
testcase_06 AC 49 ms
62,300 KB
testcase_07 AC 53 ms
64,368 KB
testcase_08 AC 62 ms
68,484 KB
testcase_09 AC 100 ms
85,472 KB
testcase_10 AC 159 ms
107,048 KB
testcase_11 AC 165 ms
109,420 KB
testcase_12 AC 213 ms
115,296 KB
testcase_13 AC 219 ms
129,064 KB
testcase_14 AC 249 ms
138,276 KB
testcase_15 AC 354 ms
178,092 KB
testcase_16 AC 446 ms
201,188 KB
testcase_17 AC 413 ms
201,320 KB
testcase_18 AC 413 ms
201,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0))
dxdy2 = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1))
dxdy3 = ((0, 1), (1, 0))
dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1))
INF = float("inf")
MOD = 998244353
mod = 998244353
MOD2 = 10**9 + 7
mod2 = 10**9 + 7
# memo : len([a,b,...,z])==26

N = int(input())
dp = [[0] * (2 * N + 1) for _ in range(2 * N + 1)]
dp[0][0] = 1
for i in range(2 * N + 1):
    for j in range(2 * N + 1 - i):
        if i - 1 >= 0 and j - 1 >= 0:
            dp[i][j] += dp[i - 1][j - 1] * ((i - 1) * (j - 1) + 1)
        if i - 2 >= 0:
            dp[i][j] += dp[i - 2][j] * (i - 1) * (i - 2) // 2
        if j - 2 >= 0:
            dp[i][j] += dp[i][j - 2] * (j - 1) * (j - 2) // 2
        dp[i][j] %= MOD

# print(dp)
for x in range(1, 2 * N + 2):
    print(dp[x - 1][2 * N + 1 - x])
0