結果

問題 No.323 yuki国
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-08-09 11:43:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,303 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 66,988 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 22:36:45
合計ジャッジ時間 4,254 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 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 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
5,376 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 3 ms
5,376 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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[51][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 <= 49 && 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(1 <= 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;
}
0