結果

問題 No.2674 k-Walk on Bipartite
ユーザー t9unkubjt9unkubj
提出日時 2024-03-15 23:24:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 901 bytes
コンパイル時間 1,801 ms
コンパイル使用メモリ 175,788 KB
実行使用メモリ 13,688 KB
最終ジャッジ日時 2024-03-15 23:24:35
合計ジャッジ時間 6,252 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 RE -
testcase_02 AC 2 ms
6,548 KB
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 86 ms
10,112 KB
testcase_09 AC 54 ms
11,848 KB
testcase_10 AC 106 ms
11,520 KB
testcase_11 AC 62 ms
9,984 KB
testcase_12 AC 102 ms
10,240 KB
testcase_13 AC 49 ms
10,796 KB
testcase_14 AC 15 ms
8,192 KB
testcase_15 RE -
testcase_16 AC 79 ms
12,448 KB
testcase_17 RE -
testcase_18 AC 31 ms
8,576 KB
testcase_19 AC 62 ms
11,364 KB
testcase_20 AC 54 ms
11,604 KB
testcase_21 RE -
testcase_22 AC 117 ms
13,688 KB
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 AC 2 ms
6,548 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
6,548 KB
testcase_31 RE -
testcase_32 AC 2 ms
6,548 KB
testcase_33 AC 2 ms
6,548 KB
testcase_34 RE -
testcase_35 AC 2 ms
6,548 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 * author:	t9unkubj
 * created:	2024-03-15 
 */

#include<bits/stdc++.h>

#ifdef t9unkubj
#define _GLIBCXX_DEBUG
#define dbg(x) cout<<__LINE__<<" "<<#x<<":="<<x<<endl;
#else 
#define dbg(x) 58
#endif

using namespace std;

//#include<atcoder/all>
//using namespace atcoder;
int main(){
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int n,m;
	cin>>n>>m;
	int s,t,k;
	cin>>s>>t>>k;
	s--,t--;
	vector<vector<int>>g(n);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int INF=2e9;
	vector<int>md(n,INF);
	queue<int>que;
	md[s]=0;
	que.push(s);
	while(que.size()){
		auto p=que.front();que.pop();
		for(auto x:g[p]){
			if(md[x]>md[p]+1)md[x]=md[p]+1,que.push(x);
		}
	}
	if(md[t]!=INF){
		if(md[t]%2!=k%2){
			assert(0);
		}
		else if(md[t]<=k){
			cout<<"Yes"<<endl;
		}
		else cout<<"Unknown"<<endl;
	}
	else cout<<"Unknown"<<endl;
}
0