結果
| 問題 | No.3099 Parentheses Decomposition |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-11 21:45:34 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 272 bytes |
| 記録 | |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 108,320 KB |
| 最終ジャッジ日時 | 2025-04-11 21:45:38 |
| 合計ジャッジ時間 | 3,727 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 4 TLE * 1 -- * 15 |
ソースコード
from math import comb
n=int(input())
s=list(input())
mod=998244353
if not ("".join(s[:n//2])=="("*(n//2) and "".join(s[n//2:])==")"*(n//2)):
print(pow(2,n//2,mod))
else:
ans=0
for i in range(n//2+1):
ans+=comb(n//2,i)**2
ans%=mod
print(ans)