結果

問題 No.1772 Many DELETEQs
ユーザー 沙耶花
提出日時 2021-12-03 00:13:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 661 bytes
コンパイル時間 4,292 ms
コンパイル使用メモリ 251,872 KB
最終ジャッジ日時 2025-01-26 02:56:57
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |                 scanf("%d %d",&x,&y);
      |                 ~~~~~^~~~~~~~~~~~~~~

ソースコード

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