結果

問題 No.323 yuki国
ユーザー sugim48sugim48
提出日時 2015-12-16 01:02:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 1,481 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 6,232 KB
最終ジャッジ日時 2023-09-10 21:16:19
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 45 ms
6,088 KB
testcase_09 AC 46 ms
6,088 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 48 ms
6,080 KB
testcase_14 AC 47 ms
6,076 KB
testcase_15 AC 45 ms
6,128 KB
testcase_16 AC 45 ms
6,120 KB
testcase_17 AC 56 ms
6,232 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 AC 33 ms
5,184 KB
testcase_20 AC 71 ms
6,152 KB
testcase_21 AC 74 ms
6,076 KB
testcase_22 AC 75 ms
6,132 KB
testcase_23 AC 71 ms
6,144 KB
testcase_24 AC 53 ms
6,172 KB
testcase_25 AC 55 ms
6,232 KB
testcase_26 AC 61 ms
6,092 KB
testcase_27 AC 58 ms
6,080 KB
testcase_28 AC 59 ms
6,132 KB
testcase_29 AC 58 ms
6,076 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1, 0};
bool vis[50][50][1100];

int main() {
	int H, W; cin >> H >> W;
	int zs, ys, xs; cin >> zs >> ys >> xs;
	int zt, yt, xt; cin >> zt >> yt >> xt;
	vector<string> a(H);
	for (int y = 0; y < H; y++)
		cin >> a[y];
	vis[ys][xs][zs] = true;
	queue<int> Y, X, Z;
	Y.push(ys); X.push(xs); Z.push(zs);
	while (!Z.empty()) {
		int y = Y.front(); Y.pop();
		int x = X.front(); X.pop();
		int z = Z.front(); Z.pop();
		for (int k = 0; k < 4; k++) {
			int _y = y + dy[k], _x = x + dx[k];
			if (_y >= 0 && _y < H && _x >= 0 && _x < W);
			else continue;
			int _z = z + (a[_y][_x] == '*' ? 1 : -1);
			if (_z > 0 && _z < 1100 && !vis[_y][_x][_z]) {
				vis[_y][_x][_z] = true;
				Y.push(_y); X.push(_x); Z.push(_z);
			}
		}
	}
	cout << (vis[yt][xt][zt] ? "Yes" : "No") << endl;
}
0