結果

問題 No.2430 Damage Zone
ユーザー 👑 NachiaNachia
提出日時 2023-08-18 21:29:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-05-06 03:19:55
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;

using Modint = atcoder::static_modint<998244353>;

int main(){
    int H, W, K; cin >> H >> W >> K; K--;
    vector<string> S(H); rep(y,H) cin >> S[y];
    vector dp(K+1, vector(H, vector(W, Modint(0))));
    rep(k,K+1) dp[k][0][0] = 1;
    for(int k=K; k>=0; k--) rep(y,H) rep(x,W){
        char c = S[y][x];
        if(c == '#') continue;
        int off = (c == 'o' ? 1 : 0);
        if(k+off > K) continue;
        if(y) dp[k][y][x] += dp[k+off][y-1][x];
        if(x) dp[k][y][x] += dp[k+off][y][x-1];
    }
    cout << dp[0][H-1][W-1].val() << endl;
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0