結果

問題 No.323 yuki国
ユーザー piyoko_212piyoko_212
提出日時 2015-12-20 23:58:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 867 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 48,408 KB
実行使用メモリ 39,588 KB
最終ジャッジ日時 2023-10-18 00:03:31
合計ジャッジ時間 6,602 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
5,296 KB
testcase_03 AC 7 ms
5,960 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
5,308 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,316 KB
testcase_08 AC 272 ms
39,568 KB
testcase_09 AC 279 ms
38,544 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 275 ms
38,624 KB
testcase_14 AC 305 ms
39,576 KB
testcase_15 AC 92 ms
23,868 KB
testcase_16 AC 299 ms
38,556 KB
testcase_17 AC 307 ms
38,632 KB
testcase_18 AC 84 ms
14,696 KB
testcase_19 AC 177 ms
24,760 KB
testcase_20 AC 334 ms
38,652 KB
testcase_21 AC 337 ms
38,656 KB
testcase_22 AC 338 ms
38,628 KB
testcase_23 AC 327 ms
38,656 KB
testcase_24 AC 98 ms
22,888 KB
testcase_25 AC 98 ms
24,344 KB
testcase_26 AC 311 ms
39,588 KB
testcase_27 AC 322 ms
38,560 KB
testcase_28 AC 321 ms
38,552 KB
testcase_29 AC 316 ms
38,556 KB
testcase_30 AC 2 ms
5,252 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 2 ms
5,296 KB
testcase_37 AC 2 ms
5,268 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         int a,b;scanf("%d%d",&a,&b);
      |                 ~~~~~^~~~~~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d%d%d%d%d%d",&c,&d,&e,&f,&g,&h);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:13:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         for(int i=0;i<a;i++)scanf("%s",str[i]);
      |                             ~~~~~^~~~~~~~~~~~~

ソースコード

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][3600];
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>=3600)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