結果

問題 No.323 yuki国
ユーザー furafura
提出日時 2020-06-14 04:43:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 2,333 ms
コンパイル使用メモリ 207,072 KB
実行使用メモリ 6,636 KB
最終ジャッジ日時 2023-09-08 15:45:41
合計ジャッジ時間 5,647 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 43 ms
6,468 KB
testcase_09 AC 43 ms
6,496 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 45 ms
6,636 KB
testcase_14 AC 45 ms
6,436 KB
testcase_15 AC 41 ms
6,516 KB
testcase_16 AC 43 ms
6,412 KB
testcase_17 AC 53 ms
6,428 KB
testcase_18 AC 17 ms
4,500 KB
testcase_19 AC 33 ms
5,348 KB
testcase_20 AC 69 ms
6,536 KB
testcase_21 AC 67 ms
6,464 KB
testcase_22 AC 70 ms
6,468 KB
testcase_23 AC 69 ms
6,372 KB
testcase_24 AC 49 ms
6,344 KB
testcase_25 AC 48 ms
6,512 KB
testcase_26 AC 57 ms
6,340 KB
testcase_27 AC 58 ms
6,512 KB
testcase_28 AC 52 ms
6,440 KB
testcase_29 AC 56 ms
6,368 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,384 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int h,w; scanf("%d%d",&h,&w);
	int sn,sy,sx; scanf("%d%d%d",&sn,&sy,&sx);
	int gn,gy,gx; scanf("%d%d%d",&gn,&gy,&gx);
	char B[50][51];
	rep(i,h) scanf("%s",B[i]);

	static bool vis[50][50][1200];
	vis[sy][sx][sn]=true;
	queue<tuple<int,int,int>> Q; Q.emplace(sy,sx,sn);
	while(!Q.empty()){
		int y,x,n; tie(y,x,n)=Q.front(); Q.pop();
		rep(k,4){
			int yy=y+dy[k],xx=x+dx[k];
			if(0<=yy && yy<h && 0<=xx && xx<w){
				int nn=n+(B[yy][xx]=='*'?1:-1);
				if(0<nn && nn<1200 && !vis[yy][xx][nn]){
					vis[yy][xx][nn]=true;
					Q.emplace(yy,xx,nn);
				}
			}
		}
	}
	puts(vis[gy][gx][gn]?"Yes":"No");

	return 0;
}
0