結果

問題 No.3071 Double Speedrun
コンテスト
ユーザー t98slider
提出日時 2025-03-21 23:39:05
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 117 ms / 6,000 ms
+ 32µs
コード長 829 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,090 ms
コンパイル使用メモリ 280,912 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2026-10-30 15:44:23
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    string str;
    array<array<mint,400>,400> dp;
    dp[0][1] = 1;
    for(int y = 0; y < h; y++){
        cin >> str;
        for(int x2 = 0; x2 < w; x2++){
            for(int x1 = 0; x1 < x2; x1++){
                if(str[x1] == '#' || str[x2] == '#') dp[x1][x2] = 0;
                if(x1 + 1 < x2 && str[x1 + 1] == '.') dp[x1 + 1][x2] += dp[x1][x2];
            }
        }
        for(int x1 = 0; x1 < w; x1++){
            for(int x2 = x1 + 1; x2 < w; x2++){
                if(x2 + 1 < w && str[x2 + 1] == '.') dp[x1][x2 + 1] += dp[x1][x2];
            }
        }
    }
    cout << dp[w - 2][w - 1].val() << '\n';
}
0