結果
問題 | No.2528 pop_(backfront or not) |
ユーザー | lloyz |
提出日時 | 2023-11-12 18:47:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 888 ms / 2,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 201,332 KB |
最終ジャッジ日時 | 2023-11-12 18:48:01 |
合計ジャッジ時間 | 6,810 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | AC | 35 ms
53,460 KB |
testcase_03 | AC | 35 ms
53,460 KB |
testcase_04 | AC | 35 ms
53,460 KB |
testcase_05 | AC | 51 ms
61,960 KB |
testcase_06 | AC | 50 ms
64,328 KB |
testcase_07 | AC | 62 ms
66,388 KB |
testcase_08 | AC | 70 ms
68,448 KB |
testcase_09 | AC | 131 ms
85,540 KB |
testcase_10 | AC | 265 ms
106,868 KB |
testcase_11 | AC | 289 ms
109,172 KB |
testcase_12 | AC | 366 ms
112,884 KB |
testcase_13 | AC | 418 ms
129,012 KB |
testcase_14 | AC | 490 ms
135,412 KB |
testcase_15 | AC | 717 ms
178,036 KB |
testcase_16 | AC | 885 ms
201,204 KB |
testcase_17 | AC | 876 ms
201,332 KB |
testcase_18 | AC | 888 ms
201,332 KB |
ソースコード
n = int(input()) mod = 998244353 inv2 = pow(2, mod - 2, mod) DP = [[0 for _ in range(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): if i >= 1 and j >= 1: DP[i][j] += DP[i - 1][j - 1] * ((i - 1) * (j - 1) + 1) % mod DP[i][j] %= mod if i >= 2: DP[i][j] += DP[i - 2][j] * (i - 1) * (i - 2) % mod * inv2 % mod DP[i][j] %= mod if j >= 2: DP[i][j] += DP[i][j - 2] * (j - 1) * (j - 2) % mod * inv2 % mod DP[i][j] %= mod for i in range(2 * n + 1): print(DP[i][2 * n - i])