結果
問題 |
No.2872 Depth of the Parentheses
|
ユーザー |
![]() |
提出日時 | 2024-09-22 16:09:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 7,308 ms |
コンパイル使用メモリ | 334,212 KB |
実行使用メモリ | 13,764 KB |
最終ジャッジ日時 | 2024-09-22 16:09:52 |
合計ジャッジ時間 | 10,958 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 TLE * 1 -- * 20 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using mint = modint998244353; int main(void) { int ix, k; cin >> ix >> k; mint x = ix; // evilケースを除去 if (k > 10) { return 0; } int k2 = k * 2; mint ans = 0; mint mx = 100; for (int bit = 0; bit < (1 << k2); bit++) { mint p = 1; int depth = 0, cur = 0; bool flag = true; for (int i = 0; i < k2; i++) { if (bit & (1 << i)) { p *= (x / mx); cur++; } else { if (cur == 0) flag = false; p *= ((mx - x) / mx); cur--; } depth = max(depth, cur); } if (cur == 0 && flag) { ans += ((mint)depth * p); } } cout << ans.val() << endl; return 0; }