結果
| 問題 |
No.2872 Depth of the Parentheses
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-07 12:54:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 591 bytes |
| コンパイル時間 | 3,890 ms |
| コンパイル使用メモリ | 250,556 KB |
| 最終ジャッジ日時 | 2025-02-24 05:08:18 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 4 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int x, K;
cin >> x >> K;
const int r = 2 * K;
mint ans;
for(int S = 0; S < (1 << r); S++){
int sv = 0, mx = 0, mn = 0;
for(int i = 0; i < r; i++){
sv += (S >> i & 1 ? 1 : -1);
mx = max(mx, sv);
mn = min(mn, sv);
}
if(sv == 0 && mn == 0) ans += mx;
}
ans *= (x * mint(100 - x) / 10000).pow(K);
cout << ans.val() << '\n';
}