結果
| 問題 | No.2528 pop_(backfront or not) |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2026-01-16 13:41:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 694 bytes |
| 記録 | |
| コンパイル時間 | 376 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 309,172 KB |
| 最終ジャッジ日時 | 2026-01-16 13:42:10 |
| 合計ジャッジ時間 | 16,344 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 3 |
ソースコード
import sys
sys.setrecursionlimit(10050)
from collections import defaultdict
dic = defaultdict(int)
MOD = 998244353
N = int(input())
N2 = 2 * N + 1
def code(x,y):
return x * N2 + y
def f(lr):
if lr in dic:
return dic[lr]
l = lr // N2
r = lr % N2
ret = 0
if l > 1 and r > 1:
ret += ((l-1)*(r-1)+ 1)*f(code(l-1,r-1))
if r > 2:
ret += (r-1)*(r-2)//2*f(code(l,r-2))
if l > 2:
ret += (l-1)*(l-2)//2*f(code(l-2,r))
if l == 1 and r == 1:
ret += 1
dic[lr] = ret % MOD
return ret % MOD
ans = [0] * (2 * N + 1)
for i in range(N + 1):
a = f(code(i,2 * N - i))
ans[i] = ans[2*N-i] = a
for a in ans:
print(a)
ntuda