結果

問題 No.2430 Damage Zone
ユーザー Ping Chung ChangPing Chung Chang
提出日時 2023-10-07 15:35:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 943 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 166,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-07 15:35:38
合計ジャッジ時間 3,546 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 110;
const int mod = 998244353;
int dp[2][mxn][mxn];
string arr[mxn];

inline int mad(int a,int b){
	a += b;
	return a>=mod?a-mod:a;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m,k;
	cin>>n>>m>>k;
	for(int i = 1;i<=n;i++)cin>>arr[i],arr[i] = "#"+arr[i];
	bool roll = 0;
	dp[roll][1][k] = 1;
	for(int i = 1;i<=n;i++){
		roll ^= 1;
		memset(dp[roll],0,sizeof(dp[roll]));
		for(int j = 1;j<=m;j++){
			if(arr[i][j] == '#')continue;
			int sh = (arr[i][j] == 'o');
			for(int h = 0;h<=k;h++){
				if(h-sh<0)continue;
				dp[roll][j][h-sh] = mad(dp[roll^1][j][h],dp[roll][j-1][h]);
			}
		}
	}
	int sum = 0;
	for(int i = 1;i<=k;i++)sum = mad(sum,dp[roll][m][i]);
	cout<<sum;
}
0