結果
| 問題 | No.2872 Depth of the Parentheses |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-10 16:31:26 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 481 bytes |
| 記録 | |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 60,928 KB |
| 最終ジャッジ日時 | 2026-06-29 14:58:18 |
| 合計ジャッジ時間 | 5,467 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
| 外部呼び出し有り |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 1 -- * 4 |
ソースコード
import sys
sys.setrecursionlimit(10 ** 8)
from functools import lru_cache
mod=998244353
x,k=map(int,input().split())
@lru_cache(maxsize=None)
def dfs(tmax,nowt,ind):
if 2*k-ind==nowt:
return tmax
if ind==2*k:
return 0
stc=0
if nowt>0:
stc+=dfs(tmax,nowt-1,ind+1)
stc+=dfs(max(tmax,nowt+1),nowt+1,ind+1)
return stc%mod
t=dfs(0,0,0)
p=x*pow(100,-1,mod)%mod
pi=(100-x)*pow(100,-1,mod)%mod
ans=pow(p,k,mod)*pow(pi,k,mod)*t%mod
print(ans)