結果

問題 No.2031 Colored Brackets
ユーザー とりゐとりゐ
提出日時 2022-06-15 21:51:49
言語 PyPy3
(7.3.13)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 505 bytes
コンパイル時間 1,170 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 311,620 KB
最終ジャッジ日時 2023-10-13 20:56:37
合計ジャッジ時間 5,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,576 KB
testcase_01 AC 68 ms
71,028 KB
testcase_02 AC 79 ms
75,668 KB
testcase_03 AC 92 ms
76,744 KB
testcase_04 TLE -
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 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
n=int(input())
S=input()
m=(n+10)//2

dp=[[0]*m for i in range(m)]
dp[0][0]=1

for s in S:
  dpn=[[0]*m for i in range(m)]
  if s=='(':
    for i in range(m-1):
      for j in range(m-1):
        dpn[i+1][j]+=dp[i][j]
        dpn[i][j+1]+=dp[i][j]
  else:
    for i in range(m-1):
      for j in range(m-1):
        dpn[i][j]+=dp[i+1][j]
        dpn[i][j]+=dp[i][j+1]
  
  dp=[[0]*m for i in range(m)]
  for i in range(m):
    for j in range(m):
      dp[i][j]=dpn[i][j]%mod

print(dp[0][0])
0