結果
問題 | No.1805 Approaching Many Typhoon |
ユーザー |
![]() |
提出日時 | 2022-02-16 01:27:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 1,514 ms |
コンパイル使用メモリ | 181,388 KB |
実行使用メモリ | 19,200 KB |
最終ジャッジ日時 | 2024-06-29 07:10:44 |
合計ジャッジ時間 | 2,750 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 WA * 3 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){set<int> I,reach;int N,M,S,G,U,input;cin>>N>>M>>S>>G;int E[M][2];vector<vector<int>> C(N,vector<int>(N));queue<int> Q;Q.push(S-1);for(int i=0;i<M;++i){cin>>E[i][0]>>E[i][1];}cin>>U;for(int i=0;i<U;++i){cin>>input;I.insert(input);}for(int i=0;i<M;++i){if(!I.count(E[i][1])){C[E[i][0]-1].emplace_back(E[i][1]-1);}}while(!Q.empty()){reach.insert(Q.front());for(int i:C[Q.front()]){if(!reach.count(i)){Q.push(i);}}Q.pop();}cout<<(reach.count(G-1)?"Yes":"No")<<endl;}