結果
| 問題 |
No.323 yuki国
|
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2015-12-16 01:02:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 80 ms / 5,000 ms |
| コード長 | 1,481 bytes |
| コンパイル時間 | 812 ms |
| コンパイル使用メモリ | 88,704 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 12:20:18 |
| 合計ジャッジ時間 | 2,984 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 32 |
ソースコード
#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;
}
sugim48