結果

問題 No.1772 Many DELETEQs
ユーザー 沙耶花沙耶花
提出日時 2021-12-03 00:13:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 661 bytes
コンパイル時間 4,156 ms
コンパイル使用メモリ 260,448 KB
実行使用メモリ 73,564 KB
最終ジャッジ日時 2023-09-18 11:31:39
合計ジャッジ時間 13,782 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
73,564 KB
testcase_01 AC 84 ms
66,164 KB
testcase_02 AC 84 ms
66,232 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000001

mint dp[4005][4005];
int main(){
	
	
	dp[0][0] = 1;
	
	rep(i,4005){
		rep(j,4005){
			if(i!=4004)dp[i+1][j] += dp[i][j];
			if(j!=4004)dp[i][j+1] += dp[i][j];
			if(i!=4004&&j!=4004)dp[i+1][j+1] += dp[i][j]*2;
		}
	}
	int q;
	cin>>q;
	
	rep(_,q){
		int x,y;
		scanf("%d %d",&x,&y);
		mint ans = 0;
		rep(i,4005){
			if(i>x)break;
			int t = i + y - x;
			if(t<0||t>=4005)continue;
			ans += dp[i][t];
		}
		printf("%d\n",ans.val());
	}
			
	
	return 0;
}
0