結果

問題 No.2944 Sigma Partition Problem
ユーザー ryusei111
提出日時 2024-10-19 13:55:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 271 ms / 4,000 ms
コード長 1,272 bytes
コンパイル時間 3,463 ms
コンパイル使用メモリ 278,436 KB
実行使用メモリ 128,768 KB
最終ジャッジ日時 2024-10-19 13:55:58
合計ジャッジ時間 11,303 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(un)n;i++)
#define repa(i,n) for(ll i=1;i<(un)n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define mod 998244353
#define dai 5000000000000000000LL
#define sho -dai
#define eps 1e-14
#define fi(x) cout<<fixed<<setprecision(x);
using ll=long long;
using un=unsigned long long;
using ld=long double;
using st=string;
using ch=char;
using bo=bool;
using P=pair<ll,ll>;
using T=tuple<ll,ll,ll>;
using vi=vector<ll>;
using vs=vector<st>;
using vc=vector<ch>;
using vb=vector<bo>;
using vp=vector<P>;
using sp=set<P>;
using ss=set<st>;
using si=set<ll>;
using vvi=vector<vi>;
using vvs=vector<vs>;
using vvb=vector<vb>;
using vvc=vector<vc>;
using vvp=vector<vp>;
using vsi=vector<set<ll>>;
const ll dx[4]={0,1,0,-1};
const ll dy[4]={1,0,-1,0};
const ll INF = 1e18;
const ll tt=998244353;
int main() {
	ll n;
	cin>>n;
	vvi dp(4005,vi(4005));
	dp[0][0]=1;
	for(int i=1;i<=4000;i++){
		for(int j=1;j<=4000;j++){
		  if(i>=j){
		    dp[i][j]=dp[i][j-1]+dp[i-j][min(j,i-j)];
		  }else{
		    dp[i][j]=dp[i][j-1];
		  }
			
			dp[i][j]%=998244353;
			//cout<<dp[i][j]<<" ";
		}
		//cout<<endl;
	}
	rep(i,n){
		ll a,b,c;
		cin>>a>>b>>c;
		cout<<dp[b][c]%998244353<<endl;
	}
}
0