結果
問題 |
No.2674 k-Walk on Bipartite
|
ユーザー |
![]() |
提出日時 | 2024-03-15 23:23:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 928 bytes |
コンパイル時間 | 1,581 ms |
コンパイル使用メモリ | 174,792 KB |
実行使用メモリ | 13,948 KB |
最終ジャッジ日時 | 2024-09-30 02:57:24 |
合計ジャッジ時間 | 5,132 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 4 RE * 10 |
ソースコード
/** * 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){ cout<<"Yes"<<endl; } else cout<<"Unknown"<<endl; } else cout<<"Unknown"<<endl; }