結果

問題 No.323 yuki国
ユーザー NekosyndromeNekosyndrome
提出日時 2015-12-16 00:06:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,342 bytes
コンパイル時間 2,720 ms
コンパイル使用メモリ 152,816 KB
実行使用メモリ 6,704 KB
最終ジャッジ日時 2023-10-13 17:13:06
合計ジャッジ時間 5,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,388 KB
testcase_01 AC 4 ms
6,480 KB
testcase_02 AC 4 ms
6,420 KB
testcase_03 AC 5 ms
6,444 KB
testcase_04 AC 3 ms
6,468 KB
testcase_05 AC 3 ms
6,484 KB
testcase_06 AC 3 ms
6,484 KB
testcase_07 AC 4 ms
6,484 KB
testcase_08 AC 29 ms
6,676 KB
testcase_09 WA -
testcase_10 AC 4 ms
6,548 KB
testcase_11 AC 3 ms
6,528 KB
testcase_12 AC 4 ms
6,416 KB
testcase_13 AC 32 ms
6,668 KB
testcase_14 AC 33 ms
6,492 KB
testcase_15 AC 31 ms
6,568 KB
testcase_16 WA -
testcase_17 AC 36 ms
6,628 KB
testcase_18 AC 14 ms
6,484 KB
testcase_19 AC 31 ms
6,436 KB
testcase_20 AC 45 ms
6,704 KB
testcase_21 AC 47 ms
6,512 KB
testcase_22 AC 46 ms
6,456 KB
testcase_23 AC 48 ms
6,456 KB
testcase_24 AC 34 ms
6,500 KB
testcase_25 AC 38 ms
6,688 KB
testcase_26 AC 37 ms
6,380 KB
testcase_27 AC 39 ms
6,388 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 3 ms
6,364 KB
testcase_31 AC 3 ms
6,476 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 3 ms
6,436 KB
testcase_36 AC 3 ms
6,472 KB
testcase_37 AC 3 ms
6,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 55
#define MT make_tuple
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
typedef tuple<int,int,int> T;
int n,m;
int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};

int sx,sy,sz;
int ex,ey,ez;
bool vis[M][M][1005];
char mp[M][M];
bool out(int x,int y)
{
	return x<=0 || y<=0 || x>n || y>m;
}
int main()
{
	int x,y,z;
	int nx,ny,nz;
	while(~scanf("%d %d",&n,&m))
	{
		RI(sz,sx,sy); sx++; sy++;
		RI(ez,ex,ey); ex++; ey++;
		REP(i,1,n) scanf("%s", mp[i]+1);

		MSET(vis,false);
		queue<T> q;
		vis[sx][sy][sz] = true;
		q.push(MT(sx,sy,sz));
		while(!q.empty())
		{
			tie(x,y,z) = q.front();
			q.pop();

			REP(i,0,3)
			{
				nx = x+dx[i];
				ny = y+dy[i];
				if(out(nx,ny)) continue;
				nz = z;
				if(mp[nx][ny]=='*') nz++;
				else nz--;

				if(nz<=0) continue;

				if(vis[nx][ny][nz]) continue;

				vis[nx][ny][nz] = true;
				q.push(MT(nx,ny,nz));
			
			}
		}

		puts(vis[ex][ey][ez] ? "Yes":"No");
	}
	return 0;
}
0