結果

問題 No.2430 Damage Zone
ユーザー umezoumezo
提出日時 2023-08-24 07:07:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 2,613 ms
コンパイル使用メモリ 202,028 KB
実行使用メモリ 20,700 KB
最終ジャッジ日時 2023-08-24 07:07:11
合計ジャッジ時間 3,839 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
18,120 KB
testcase_01 AC 9 ms
9,520 KB
testcase_02 AC 19 ms
18,576 KB
testcase_03 AC 2 ms
4,580 KB
testcase_04 AC 4 ms
5,140 KB
testcase_05 AC 7 ms
7,328 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,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,748 KB
testcase_12 AC 3 ms
4,712 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 19 ms
18,508 KB
testcase_15 AC 19 ms
18,816 KB
testcase_16 AC 20 ms
19,188 KB
testcase_17 AC 11 ms
11,996 KB
testcase_18 AC 5 ms
6,936 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 12 ms
12,884 KB
testcase_21 AC 5 ms
5,736 KB
testcase_22 AC 10 ms
11,380 KB
testcase_23 AC 10 ms
11,748 KB
testcase_24 AC 9 ms
9,480 KB
testcase_25 AC 20 ms
20,536 KB
testcase_26 AC 20 ms
20,652 KB
testcase_27 AC 18 ms
20,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
ll dp[110][110][220];

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> S(h);
  rep(i,h) cin>>S[i];
  
  dp[0][0][0]=1;
  rep(i,h) rep(j,w) rep(l,k){
  	if(dp[i][j][l]==0) continue;
  	
  	if(i<h-1 && S[i+1][j]=='#') ;
    else if(i<h-1 && S[i+1][j]=='.') dp[i+1][j][l]=(dp[i+1][j][l]+dp[i][j][l])%MOD;
  	else if(i<h-1)  dp[i+1][j][l+1]=(dp[i+1][j][l+1]+dp[i][j][l])%MOD;
  	
  	if(j<w-1 && S[i][j+1]=='#') ;
  	else if(j<w-1 && S[i][j+1]=='.') dp[i][j+1][l]=(dp[i][j+1][l]+dp[i][j][l])%MOD;
  	else if(j<w-1)  dp[i][j+1][l+1]=(dp[i][j+1][l+1]+dp[i][j][l])%MOD;
  }
  ll ans=0;
  rep(l,k) ans=(ans+dp[h-1][w-1][l])%MOD;
  cout<<ans<<endl;

  return 0;
}
0