結果

問題 No.2528 pop_(backfront or not)
ユーザー titiatitia
提出日時 2023-11-03 22:45:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 719 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 395,264 KB
最終ジャッジ日時 2023-11-03 22:46:08
合計ジャッジ時間 14,221 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
256,048 KB
testcase_01 AC 193 ms
251,676 KB
testcase_02 AC 215 ms
251,676 KB
testcase_03 AC 200 ms
251,676 KB
testcase_04 AC 192 ms
251,676 KB
testcase_05 AC 224 ms
271,264 KB
testcase_06 AC 246 ms
271,224 KB
testcase_07 AC 295 ms
271,832 KB
testcase_08 AC 256 ms
272,312 KB
testcase_09 AC 362 ms
277,776 KB
testcase_10 AC 673 ms
304,392 KB
testcase_11 AC 687 ms
307,820 KB
testcase_12 AC 957 ms
330,432 KB
testcase_13 AC 1,074 ms
337,620 KB
testcase_14 AC 1,388 ms
339,224 KB
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

mod=998244353

N=int(input())

LIST=[[-1]*5000 for i in range(5000)]
def calc(x,y):
    if y>(x+1)//2:
        y=x-y+1
    if y==1 or y==x:
        return 0
    if x==3:
        if y==2:
            return 1
        else:
            return 0

    if LIST[x][y]!=-1:
        return LIST[x][y]

    ANS=0

    # 左から二つ
    ANS+=(y-2)*(y-3)//2*calc(x-2,y-2)
    # 左右一つずつ
    ANS+=((y-2)*(x-y-1)+1)*calc(x-2,y-1)
    
    # 右から二つ
    ANS+=(x-y-1)*(x-y-2)//2*calc(x-2,y)

    LIST[x][y]=ANS%mod

    return LIST[x][y]

ANS=[]
for i in range(1,N*2+2):
    ANS.append(calc(N*2+1,i))

print("\n".join(map(str,ANS)))
    

    
0