結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 3 ms
5,308 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,276 KB
testcase_08 AC 155 ms
23,960 KB
testcase_09 AC 155 ms
23,896 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 159 ms
23,912 KB
testcase_14 AC 178 ms
23,912 KB
testcase_15 AC 94 ms
22,944 KB
testcase_16 AC 179 ms
23,916 KB
testcase_17 AC 181 ms
23,980 KB
testcase_18 AC 47 ms
10,260 KB
testcase_19 AC 108 ms
15,852 KB
testcase_20 AC 198 ms
24,004 KB
testcase_21 AC 205 ms
23,996 KB
testcase_22 AC 202 ms
24,000 KB
testcase_23 AC 197 ms
24,000 KB
testcase_24 AC 102 ms
22,860 KB
testcase_25 AC 100 ms
22,824 KB
testcase_26 AC 187 ms
23,916 KB
testcase_27 AC 189 ms
23,916 KB
testcase_28 AC 183 ms
23,912 KB
testcase_29 AC 181 ms
23,912 KB
testcase_30 AC 1 ms
4,348 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
4,348 KB
testcase_37 AC 2 ms
5,276 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][2100];
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>=2100)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