結果
問題 | No.323 yuki国 |
ユーザー |
![]() |
提出日時 | 2016-04-25 10:50:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 840 bytes |
コンパイル時間 | 1,228 ms |
コンパイル使用メモリ | 168,052 KB |
実行使用メモリ | 9,600 KB |
最終ジャッジ日時 | 2024-10-04 15:42:28 |
合計ジャッジ時間 | 3,969 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 29 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int dx[]{-1, 0, 1, 0}; const int dy[]{0, -1, 0, 1}; int n, m; int a, sx, sy, b, gx, gy; string c[50]; bool vis[50][50][2510]; int main(){ cin >> n >> m >> a >> sx >> sy >> b >> gx >> gy; for (int i = 0; i < n; i++) cin >> c[i]; queue<tuple<int, int, int>> q; vis[sx][sy][a] = true; q.emplace(sx, sy, a); while (q.size()){ int x, y, s; tie(x, y, s) = q.front(); q.pop(); for (int i = 0; i < 4; i++){ int nx = x + dx[i]; int ny = y + dy[i]; if (nx < 0 || n <= nx || ny < 0 || m <= ny) continue; int ns = s + (c[nx][ny] == '*' ? 1 : -1); if (ns < 0 || ns > 2510) continue; if (vis[nx][ny][ns]) continue; vis[nx][ny][ns] = true; q.emplace(nx, ny, ns); } } cout << (vis[gx][gy][b] ? "Yes\n" : "No\n"); }