結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 5 ms
6,016 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 6 ms
5,888 KB
testcase_04 AC 5 ms
5,888 KB
testcase_05 AC 5 ms
5,888 KB
testcase_06 AC 5 ms
6,016 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 32 ms
6,016 KB
testcase_09 WA -
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 5 ms
6,016 KB
testcase_12 AC 5 ms
6,016 KB
testcase_13 AC 34 ms
6,016 KB
testcase_14 AC 35 ms
6,016 KB
testcase_15 AC 35 ms
5,760 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 16 ms
6,016 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 79 ms
6,016 KB
testcase_21 AC 75 ms
6,016 KB
testcase_22 AC 77 ms
6,016 KB
testcase_23 AC 77 ms
6,016 KB
testcase_24 AC 52 ms
6,016 KB
testcase_25 AC 48 ms
6,016 KB
testcase_26 AC 49 ms
6,016 KB
testcase_27 AC 51 ms
6,016 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 5 ms
6,016 KB
testcase_32 AC 5 ms
5,888 KB
testcase_33 AC 4 ms
6,016 KB
testcase_34 AC 5 ms
6,016 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 5 ms
5,760 KB
testcase_37 AC 5 ms
5,888 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[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;
}
0