結果

問題 No.323 yuki国
ユーザー piyoko_212piyoko_212
提出日時 2015-12-21 00:02:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,075 ms / 5,000 ms
コード長 870 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 50,676 KB
実行使用メモリ 121,472 KB
最終ジャッジ日時 2023-09-10 21:24:46
合計ジャッジ時間 15,555 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
5,040 KB
testcase_03 AC 19 ms
8,364 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 5 ms
5,676 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 2 ms
5,124 KB
testcase_08 AC 781 ms
121,456 KB
testcase_09 AC 778 ms
121,288 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 784 ms
121,472 KB
testcase_14 AC 788 ms
121,380 KB
testcase_15 AC 83 ms
24,348 KB
testcase_16 AC 785 ms
121,300 KB
testcase_17 AC 937 ms
121,456 KB
testcase_18 AC 257 ms
39,864 KB
testcase_19 AC 524 ms
75,044 KB
testcase_20 AC 1,056 ms
121,412 KB
testcase_21 AC 1,075 ms
121,460 KB
testcase_22 AC 1,055 ms
121,432 KB
testcase_23 AC 1,040 ms
121,372 KB
testcase_24 AC 94 ms
22,640 KB
testcase_25 AC 90 ms
24,308 KB
testcase_26 AC 916 ms
121,372 KB
testcase_27 AC 970 ms
121,312 KB
testcase_28 AC 874 ms
121,236 KB
testcase_29 AC 854 ms
121,376 KB
testcase_30 AC 2 ms
4,996 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 3 ms
5,192 KB
testcase_37 AC 3 ms
5,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
char str[100][100];
int bfs[52][52][12100];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	int c,d,e,f,g,h;
	scanf("%d%d%d%d%d%d",&c,&d,&e,&f,&g,&h);
	for(int i=0;i<a;i++)scanf("%s",str[i]);
	bfs[d][e][c]=1;
	queue<pair<pair<int,int>,int> > Q;
	Q.push(make_pair(make_pair(d,e),c));
	while(Q.size()){
		int row=Q.front().first.first;
		int col=Q.front().first.second;
		int yu=Q.front().second;
		Q.pop();
		for(int i=0;i<4;i++){
			int tr=row+dx[i];int tc=col+dy[i];
			int ty=yu;
			if(tr<0||tc<0||tr>=a||tc>=b)continue;
			if(str[tr][tc]=='*')ty++;
			else ty--;
			if(ty<=0||ty>=12100)continue;
			if(bfs[tr][tc][ty])continue;
			bfs[tr][tc][ty]=1;
			Q.push(make_pair(make_pair(tr,tc),ty));
		}
	}
	if(bfs[g][h][f])printf("Yes\n");else printf("No\n");
}
0