結果
問題 | No.2872 Depth of the Parentheses |
ユーザー |
👑 |
提出日時 | 2024-07-16 03:32:35 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 888 bytes |
コンパイル時間 | 744 ms |
コンパイル使用メモリ | 60,860 KB |
最終ジャッジ日時 | 2025-02-23 15:49:28 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:5:10: fatal error: testlib.h: No such file or directory 5 | #include "testlib.h" | ^~~~~~~~~~~ compilation terminated.
ソースコード
#include <bits/stdc++.h>#include <atcoder/modint.hpp>#include "testlib.h"using namespace std;using mint = atcoder::modint998244353;int main() {registerValidation();int x = inf.readInt(0, 100);inf.readSpace();int k = inf.readInt(1, 10);inf.readEoln();inf.readEof();mint ans = 0;for (int bit = 0; bit < (1 << 2 * k); bit++) {auto depth = [&]() -> mint {int cnt = 0;int ans = 0;for (int i = 0; i < 2*k; i++) {if ((bit >> i) & 1)cnt++;elsecnt--;if (cnt < 0) return 0;ans = max(ans, cnt);}return cnt == 0 ? ans : 0;};ans += depth();}mint p = mint(x) / 100;ans *= p.pow(k) * (mint(1) - p).pow(k);cout << ans.val() << endl;}