結果
問題 | No.2688 Cell Proliferation (Hard) |
ユーザー | fumofumofuni |
提出日時 | 2024-03-21 00:35:41 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,967 ms / 4,000 ms |
コード長 | 2,244 bytes |
コンパイル時間 | 4,826 ms |
コンパイル使用メモリ | 271,340 KB |
実行使用メモリ | 40,708 KB |
最終ジャッジ日時 | 2024-03-21 00:36:17 |
合計ジャッジ時間 | 35,045 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
11,172 KB |
testcase_01 | AC | 6 ms
11,172 KB |
testcase_02 | AC | 5 ms
11,172 KB |
testcase_03 | AC | 111 ms
13,272 KB |
testcase_04 | AC | 1,897 ms
39,764 KB |
testcase_05 | AC | 905 ms
25,980 KB |
testcase_06 | AC | 414 ms
18,460 KB |
testcase_07 | AC | 406 ms
18,444 KB |
testcase_08 | AC | 1,837 ms
39,324 KB |
testcase_09 | AC | 1,069 ms
27,852 KB |
testcase_10 | AC | 1,925 ms
40,148 KB |
testcase_11 | AC | 1,851 ms
39,524 KB |
testcase_12 | AC | 433 ms
18,756 KB |
testcase_13 | AC | 1,963 ms
40,708 KB |
testcase_14 | AC | 989 ms
27,096 KB |
testcase_15 | AC | 1,967 ms
40,708 KB |
testcase_16 | AC | 1,004 ms
26,992 KB |
testcase_17 | AC | 926 ms
26,404 KB |
testcase_18 | AC | 1,938 ms
40,252 KB |
testcase_19 | AC | 955 ms
26,452 KB |
testcase_20 | AC | 470 ms
19,180 KB |
testcase_21 | AC | 466 ms
19,176 KB |
testcase_22 | AC | 950 ms
26,268 KB |
testcase_23 | AC | 493 ms
19,604 KB |
testcase_24 | AC | 1,933 ms
40,052 KB |
testcase_25 | AC | 437 ms
18,904 KB |
testcase_26 | AC | 1,928 ms
40,364 KB |
testcase_27 | AC | 955 ms
26,508 KB |
testcase_28 | AC | 996 ms
27,024 KB |
ソースコード
#include<bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define rep(i,n) for(ll i=0;i<n;i++) #define repl(i,l,r) for(ll i=(l);i<(r);i++) #define per(i,n) for(ll i=(n)-1;i>=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define pqueue(x) priority_queue<x,vector<x>,greater<x>> #define all(x) (x).begin(),(x).end() #define CST(x) cout<<fixed<<setprecision(x) #define vtpl(x,y,z) vector<tuple<x,y,z>> #define rev(x) reverse(x); using ll=long long; using vl=vector<ll>; using vvl=vector<vector<ll>>; using pl=pair<ll,ll>; using vpl=vector<pl>; using vvpl=vector<vpl>; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[9]={0,1,-1,0,1,1,-1,-1,0}; const ll dx[9]={1,0,0,-1,1,-1,1,-1,0}; 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; } using mint=modint998244353; mint p1,p2,q1,q2; vector<mint> a(1000010); vector<mint> dp(1000010); void induce(ll l,ll mid,ll r){ vector<mint> ds; vector<mint> nds; for(ll i=l;i<mid;i++){ ds.emplace_back(dp[i]); } for(ll i=0;i<r+1-l;i++){ nds.emplace_back(a[i]); } auto ret=convolution(ds,nds); mint sum=0; ll now=0; for(int i=mid;i<r;i++){ dp[i]+=ret[i-1-l]; } //cout << l << " " << mid << " " << r << endl; //rep(i,4)cout << dp[i] <<" ";cout << endl; } void dfs(ll l,ll r){ if(l+1==r){ //cout << dp[l] << endl; dp[l]*=p1; dp[l]+=a[l]; return; } ll mid=(l+r)/2; dfs(l,mid); induce(l,mid,r); dfs(mid,r); } int main(){ vl hoge(4);rep(i,4)cin >> hoge[i]; //cin >> p1.val() >> p2.val() >> q1.val() >> q2.val(); p1=hoge[0];p2=hoge[1]; q1=hoge[2];q2=hoge[3]; ll n;cin >> n; a[0]=1; q1/=q2; p1/=p2; mint c=1; for(ll i=1;i<=n;i++){ c*=q1; a[i]=a[i-1]*c; } dfs(0,n+1); //rep(i,n+1)cout << dp[i] <<" ";cout << endl; cout << dp[n].val() << endl; }