結果

問題 No.323 yuki国
ユーザー chocoruskchocorusk
提出日時 2018-12-21 16:57:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,321 bytes
コンパイル時間 1,360 ms
コンパイル使用メモリ 103,520 KB
実行使用メモリ 8,460 KB
最終ジャッジ日時 2023-10-26 01:32:54
合計ジャッジ時間 4,344 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,344 KB
testcase_01 AC 5 ms
8,344 KB
testcase_02 AC 5 ms
8,344 KB
testcase_03 AC 7 ms
8,344 KB
testcase_04 AC 5 ms
8,344 KB
testcase_05 AC 5 ms
8,344 KB
testcase_06 AC 5 ms
8,344 KB
testcase_07 AC 5 ms
8,344 KB
testcase_08 AC 67 ms
8,424 KB
testcase_09 AC 66 ms
8,424 KB
testcase_10 AC 5 ms
8,344 KB
testcase_11 AC 5 ms
8,344 KB
testcase_12 AC 5 ms
8,344 KB
testcase_13 AC 73 ms
8,428 KB
testcase_14 AC 6 ms
8,412 KB
testcase_15 AC 40 ms
8,432 KB
testcase_16 WA -
testcase_17 AC 94 ms
8,432 KB
testcase_18 AC 32 ms
8,420 KB
testcase_19 AC 65 ms
8,432 KB
testcase_20 AC 171 ms
8,452 KB
testcase_21 AC 175 ms
8,452 KB
testcase_22 AC 174 ms
8,452 KB
testcase_23 AC 164 ms
8,452 KB
testcase_24 AC 58 ms
8,432 KB
testcase_25 AC 54 ms
8,432 KB
testcase_26 AC 109 ms
8,436 KB
testcase_27 AC 118 ms
8,432 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 5 ms
8,344 KB
testcase_31 AC 5 ms
8,344 KB
testcase_32 AC 5 ms
8,344 KB
testcase_33 AC 5 ms
8,344 KB
testcase_34 AC 5 ms
8,344 KB
testcase_35 AC 4 ms
8,344 KB
testcase_36 AC 5 ms
8,344 KB
testcase_37 AC 5 ms
8,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
int h, w;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
bool check(int x, int y){
  if(x<0 || x>=h || y<0 || y>=w) return false;
  return true;
}
int main()
{
	cin>>h>>w;
	int a, b, sx, sy, gx, gy;
	cin>>a>>sx>>sy;
	cin>>b>>gx>>gy;
	string m[50];
	for(int i=0; i<h; i++) cin>>m[i];
	queue<Pi> que;
	bool ok[50][50][2001];
	ok[sx][sy][a]=1; que.push({{sx, sy}, a});
	while(!que.empty()){
		Pi p=que.front(); que.pop();
		int x=p.first.first, y=p.first.second, t=p.second;
		for(int k=0; k<4; k++){
			int x1=x+dx[k], y1=y+dy[k];
			if(!check(x1, y1)) continue;
			if(m[x1][y1]=='.'){
				if(t==1) continue;
				if(ok[x1][y1][t-1]) continue;
				ok[x1][y1][t-1]=1;
				que.push({{x1, y1}, t-1});
			}else{
				if(t>=2000) continue;
				if(ok[x1][y1][t+1]) continue;
				ok[x1][y1][t+1]=1;
				que.push({{x1, y1}, t+1});
			}
		}
	}
	if(ok[gx][gy][b]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}
0