結果

問題 No.2430 Damage Zone
ユーザー kotatsugamekotatsugame
提出日時 2023-08-18 21:22:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 718 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 73,216 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-05-06 03:09:39
合計ジャッジ時間 1,616 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int H,W,K;
mint dp[100][100][200];
string S[100];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>H>>W>>K;
	for(int i=0;i<H;i++)cin>>S[i];
	dp[0][0][K-1]++;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)for(int k=0;k<K;k++)
	{
		if(i+1<H&&S[i+1][j]!='#')
		{
			int nk=k;
			if(S[i+1][j]=='o')nk--;
			if(nk>=0)dp[i+1][j][nk]+=dp[i][j][k];
		}
		if(j+1<W&&S[i][j+1]!='#')
		{
			int nk=k;
			if(S[i][j+1]=='o')nk--;
			if(nk>=0)dp[i][j+1][nk]+=dp[i][j][k];
		}
	}
	mint ans=0;
	for(int k=0;k<K;k++)ans+=dp[H-1][W-1][k];
	cout<<ans.val()<<endl;
}
0