結果

問題 No.323 yuki国
ユーザー chocoruskchocorusk
提出日時 2018-12-21 16:57:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,321 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 101,428 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-09-25 09:33:46
合計ジャッジ時間 5,344 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
13,056 KB
testcase_01 AC 9 ms
13,184 KB
testcase_02 AC 10 ms
13,056 KB
testcase_03 AC 13 ms
13,056 KB
testcase_04 AC 9 ms
12,928 KB
testcase_05 AC 10 ms
13,184 KB
testcase_06 AC 9 ms
13,056 KB
testcase_07 AC 9 ms
13,056 KB
testcase_08 AC 172 ms
13,312 KB
testcase_09 AC 173 ms
13,312 KB
testcase_10 AC 9 ms
12,928 KB
testcase_11 AC 9 ms
13,056 KB
testcase_12 AC 9 ms
13,184 KB
testcase_13 AC 175 ms
13,312 KB
testcase_14 AC 10 ms
13,184 KB
testcase_15 AC 52 ms
13,312 KB
testcase_16 WA -
testcase_17 AC 226 ms
13,056 KB
testcase_18 AC 62 ms
13,184 KB
testcase_19 AC 130 ms
13,184 KB
testcase_20 AC 375 ms
13,312 KB
testcase_21 AC 379 ms
13,184 KB
testcase_22 AC 374 ms
13,312 KB
testcase_23 AC 360 ms
13,312 KB
testcase_24 AC 72 ms
13,312 KB
testcase_25 AC 68 ms
13,312 KB
testcase_26 AC 253 ms
13,184 KB
testcase_27 AC 276 ms
13,056 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 9 ms
13,184 KB
testcase_31 AC 10 ms
13,056 KB
testcase_32 AC 10 ms
13,184 KB
testcase_33 AC 9 ms
13,184 KB
testcase_34 AC 9 ms
12,928 KB
testcase_35 AC 9 ms
13,056 KB
testcase_36 AC 9 ms
13,056 KB
testcase_37 AC 9 ms
13,184 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][4001];
	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>=4000) 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