結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 52 ms
11,848 KB
testcase_10 RE -
testcase_11 AC 58 ms
9,984 KB
testcase_12 RE -
testcase_13 AC 48 ms
10,796 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 29 ms
8,576 KB
testcase_19 AC 60 ms
11,364 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 116 ms
13,688 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 2 ms
6,676 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
6,676 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

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);
		}
	}
	assert(md[t]==INF);
	if(md[t]!=INF){
		if(md[t]%2!=k%2){
			cout<<"No"<<endl;
		}
		else if(md[t]<=k){
			assert(0);
		}
		else cout<<"Unknown"<<endl;
	}
	else cout<<"Unknown"<<endl;
}
0