結果

問題 No.2688 Cell Proliferation (Hard)
ユーザー 👑 potato167potato167
提出日時 2024-03-21 12:03:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,927 ms / 4,000 ms
コード長 720 bytes
コンパイル時間 4,679 ms
コンパイル使用メモリ 271,216 KB
実行使用メモリ 37,552 KB
最終ジャッジ日時 2024-03-21 12:04:26
合計ジャッジ時間 34,294 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 126 ms
6,676 KB
testcase_04 AC 1,820 ms
35,080 KB
testcase_05 AC 897 ms
20,428 KB
testcase_06 AC 394 ms
11,712 KB
testcase_07 AC 416 ms
11,572 KB
testcase_08 AC 1,775 ms
34,652 KB
testcase_09 AC 1,000 ms
26,144 KB
testcase_10 AC 1,861 ms
36,156 KB
testcase_11 AC 1,824 ms
35,512 KB
testcase_12 AC 410 ms
12,500 KB
testcase_13 AC 1,927 ms
37,536 KB
testcase_14 AC 922 ms
23,408 KB
testcase_15 AC 1,927 ms
37,552 KB
testcase_16 AC 935 ms
22,868 KB
testcase_17 AC 909 ms
21,524 KB
testcase_18 AC 1,864 ms
36,408 KB
testcase_19 AC 913 ms
21,620 KB
testcase_20 AC 436 ms
13,452 KB
testcase_21 AC 459 ms
13,380 KB
testcase_22 AC 898 ms
21,164 KB
testcase_23 AC 462 ms
14,192 KB
testcase_24 AC 1,850 ms
35,916 KB
testcase_25 AC 441 ms
12,760 KB
testcase_26 AC 1,880 ms
36,696 KB
testcase_27 AC 913 ms
21,768 KB
testcase_28 AC 939 ms
22,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
#define rep(i,a,b) for(int i=a;i<b;i++)
using mint=modint998244353;
int main(){
	int a,b,c,d,T;
	cin>>a>>b>>c>>d>>T;
	mint P=mint(a)/mint(b);
	mint Q=mint(c)/mint(d);
	vector<mint> X(T+1,1);
	rep(i,0,T) X[i+1]=X[i]*Q.pow(i+1);
	vector<mint> dp(T+1);
	dp[0]=1;
	auto f=[&](auto self,int l,int r) -> void {
		if(l+1==r) return;
		int m=(l+r)/2;
		self(self,l,m);
		vector<mint> A(m-l),B(r-l);
		rep(i,l,m) A[i-l]=dp[i];
		rep(i,1,r-l) B[i]=X[i-1]*P;
		auto C=convolution(A,B);
		rep(i,m-l,r-l) dp[i+l]+=C[i];
		self(self,m,r);
	};
	f(f,0,T+1);
	mint ans=0;
	for(int i=T;i>=0;i--){
		ans+=dp[i]*X[T-i];
	}
	cout<<ans.val()<<"\n";
}
0