結果
問題 |
No.3071 Double Speedrun
|
ユーザー |
![]() |
提出日時 | 2025-03-21 22:54:32 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,484 bytes |
コンパイル時間 | 6,525 ms |
コンパイル使用メモリ | 332,824 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2025-03-21 22:54:46 |
合計ジャッジ時間 | 14,099 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 12 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; using mint = modint998244353; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int h, w; cin >> h >> w; vector<string> s(h); rep(i, 0, h) cin >> s[i]; map<pair<int, int>, mint> dp; dp[{1, w}] = 1; rep(dist, 1, h + w - 3) { map<pair<int, int>, mint> ndp; for (auto [p, v] : dp) { int ai = p.first / w, aj = p.first % w; int bi = p.second / w, bj = p.second % w; rep(i, 0, 2) rep(j, 0, 2) { int nai = ai + i, naj = aj + 1 - i; int nbi = bi + j, nbj = bj + 1 - j; if (nai >= h || naj >= w || nbi >= h || nbj >= w) continue; if (s[nai][naj] == '#' || s[nbi][nbj] == '#') continue; if (nai == nbi && naj == nbj) continue; if (nai == bi && naj == bj) continue; if (ai == nbi && aj == nbj) continue; int np = nai * w + naj, nq = nbi * w + nbj; ndp[{np, nq}] += v; } } dp = ndp; } if (dp.size() == 0) { cout << 0 << endl; return 0; } for (auto [p, v] : dp) { cout << v.val() << endl; } }