結果
| 問題 |
No.323 yuki国
|
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-08-09 11:47:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,307 bytes |
| コンパイル時間 | 586 ms |
| コンパイル使用メモリ | 67,244 KB |
| 実行使用メモリ | 6,016 KB |
| 最終ジャッジ日時 | 2024-11-07 07:48:34 |
| 合計ジャッジ時間 | 2,534 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 27 WA * 5 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int dx[4] = {1, 0, 0, -1};
int dy[4] = {0, 1, -1, 0};
int h, w;
int a, si, sj;
int b, gi, gj;
string s[51];
bool board[1010][51][51];
struct t{
int size, y, x;
t(int size, int y, int x) : size(size), y(y), x(x) {}
};
int main(void){
cin >> h >> w;
cin >> a >> si >> sj;
cin >> b >> gi >> gj;
rep(i, h) cin >> s[i];
queue<t> q;
q.push(t(a, si, sj));
board[a][si][sj] = true;
while(!q.empty()){
t now = q.front(); q.pop();
for (int i = 0; i < 4; ++i){
if(0 <= now.y + dy[i] && now.y + dy[i] < h &&
0 <= now.x + dx[i] && now.x + dx[i] < w){
if(s[now.y + dy[i]][now.x + dx[i]] == '*'){
if(now.size <= 1000 && board[now.size + 1][now.y + dy[i]][now.x + dx[i]] == false){
board[now.size + 1][now.y + dy[i]][now.x + dx[i]] = true;
q.push(t(now.size + 1, now.y + dy[i], now.x + dx[i]));
}
}else{
if(2 <= now.size && board[now.size - 1][now.y + dy[i]][now.x + dx[i]] == false){
board[now.size - 1][now.y + dy[i]][now.x + dx[i]] = true;
q.push(t(now.size - 1, now.y + dy[i], now.x + dx[i]));
}
}
}
}
}
if(board[b][gi][gj]) printf("Yes\n");
else printf("No\n");
return 0;
}
srup٩(๑`н´๑)۶