結果
問題 |
No.2674 k-Walk on Bipartite
|
ユーザー |
![]() |
提出日時 | 2024-03-15 23:00:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 862 bytes |
コンパイル時間 | 1,748 ms |
コンパイル使用メモリ | 198,504 KB |
最終ジャッジ日時 | 2025-02-20 05:52:51 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 6 |
ソースコード
/** * 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); } vector<int>md(n,-1); auto dfs=[&](auto&dfs,int now)->void{ for(auto x:g[now]){ if(md[x]==-1)md[x]=md[now]+1,dfs(dfs,x); } }; md[s]=0; dfs(dfs,s); if(md[t]!=-1){ if(md[t]%2!=k%2){ cout<<"No"<<endl; } else if(md[t]<=k){ cout<<"Yes"<<endl; } else cout<<"Unknown"<<endl; } else cout<<"Unknown"<<endl; }