結果

問題 No.2872 Depth of the Parentheses
ユーザー FplusFplusF
提出日時 2024-09-06 22:00:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 1,282 bytes
コンパイル時間 2,900 ms
コンパイル使用メモリ 246,236 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-06 22:01:00
合計ジャッジ時間 4,168 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define replr(i,l,r) for (ll i=(ll)(l);i<(ll)(r);i++)
#define all(v) v.begin(),v.end()
#define len(v) ((ll)v.size())
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
#include <atcoder/modint>
using mint=atcoder::modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll x,k;
cin >> x >> k;
assert(x<=100&&k<=10);
k*=2;
mint ans=0;
mint p=(mint)x/(mint)100;
rep(i,1<<k){
ll s=0,mx=0;
rep(j,k){
if(i&(1<<j)) s++;
else s--;
if(s<0){
s=INF;
break;
}
chmax(mx,s);
}
if(s==0){
mint now=1;
rep(j,k){
if(i&(1<<j)) now*=p;
else now*=(1-p);
}
ans+=mx*now;
}
}
cout << ans.val() << '\n';
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0