結果
| 問題 |
No.2872 Depth of the Parentheses
|
| コンテスト | |
| ユーザー |
tama04
|
| 提出日時 | 2024-09-22 15:54:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| コンパイル時間 | 7,590 ms |
| コンパイル使用メモリ | 335,864 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-09-22 15:55:16 |
| 合計ジャッジ時間 | 18,820 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 5 -- * 5 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
int main(void) {
int x, k;
cin >> x >> k;
mint sx = x;
// evilケースを除去
if (k > 10) {
return 0;
}
int k2 = k * 2;
mint ans = 0;
mint sq = 100;
for (int bit = 0; bit < (1 << k2); bit++) {
mint p = 1, mx = 100;
int depth = 0, cur = 0;
bool flag = true;
// 表示
//string s;
//for (int i = 0; i < k2; i++) {
// if (bit & (1 << i)) s.push_back('(');
// else s.push_back(')');
//}
//cout << s << endl;
for (int i = 0; i < k2; i++) {
if (bit & (1 << i)) {
p *= (sx / sq);
cur++;
}
else {
if (cur == 0) flag = false;
p *= ((mx - sx) / sq);
cur--;
}
//cout << " i = " << i << " p = " << p.val() << endl;
depth = max(depth, cur);
}
mint sd = depth;
//if (cur == 0 && flag) {
// cout << s << " p = " << p.val() << " depth = " << depth << endl;
//}
if (cur == 0 && flag) {
ans += (sd * p);
}
}
cout << ans.val() << endl;
return 0;
}
tama04