結果

問題 No.323 yuki国
ユーザー kotatsugamekotatsugame
提出日時 2020-03-02 23:43:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 774 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 76,708 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-04-21 22:57:36
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 78 ms
8,448 KB
testcase_09 AC 78 ms
8,320 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 86 ms
8,320 KB
testcase_14 AC 81 ms
8,448 KB
testcase_15 AC 44 ms
8,448 KB
testcase_16 AC 81 ms
8,448 KB
testcase_17 AC 101 ms
8,576 KB
testcase_18 AC 28 ms
5,376 KB
testcase_19 AC 70 ms
6,784 KB
testcase_20 AC 125 ms
8,448 KB
testcase_21 AC 129 ms
8,448 KB
testcase_22 AC 126 ms
8,576 KB
testcase_23 AC 122 ms
8,448 KB
testcase_24 AC 56 ms
8,448 KB
testcase_25 AC 55 ms
8,448 KB
testcase_26 AC 101 ms
8,448 KB
testcase_27 AC 109 ms
8,448 KB
testcase_28 AC 90 ms
8,448 KB
testcase_29 AC 93 ms
8,448 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<queue>
using namespace std;
int H,W;
int sa,sx,sy,ga,gx,gy;
string M[50];
bool vis[50][50][2000];
int d[4]={1,0,-1};
main()
{
	cin>>H>>W;
	cin>>sa>>sx>>sy>>ga>>gx>>gy;
	sa--,ga--;
	for(int i=0;i<H;i++)cin>>M[i];
	vis[sx][sy][sa]=true;
	queue<pair<pair<int,int>,int> >P;
	P.push(make_pair(make_pair(sx,sy),sa));
	while(!P.empty())
	{
		int x=P.front().first.first,y=P.front().first.second;
		int a=P.front().second;
		P.pop();
		for(int r=0;r<4;r++)
		{
			int tx=x+d[r],ty=y+d[r^1];
			if(tx<0||ty<0||tx>=H||ty>=W)continue;
			int ta=a+(M[tx][ty]=='*'?1:-1);
			if(ta<0||ta>=2000)continue;
			if(!vis[tx][ty][ta])
			{
				vis[tx][ty][ta]=true;
				P.push(make_pair(make_pair(tx,ty),ta));
			}
		}
	}
	cout<<(vis[gx][gy][ga]?"Yes":"No")<<endl;
}
0