結果
問題 | No.1805 Approaching Many Typhoon |
ユーザー |
👑 ![]() |
提出日時 | 2022-01-12 20:18:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,061 bytes |
コンパイル時間 | 919 ms |
コンパイル使用メモリ | 80,824 KB |
最終ジャッジ日時 | 2025-01-27 10:36:48 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 WA * 1 RE * 12 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using i64 = long long; using u64 = unsigned long long; using i32 = int; using u32 = unsigned int; #define rep(i,n) for(int i=0; i<(n); i++) int N, M; int S, G; vector<vector<int>> E; vector<int> enabled; int main() { cin >> N >> M; cin >> S >> G; S--; G--; E.resize(M); rep(i,M){ int u,v; cin >> u >> v; u--; v--; E[u].push_back(v); E[v].push_back(u); } enabled.assign(N,1); int U; cin >> U; rep(i,U){ int a; cin >> a; enabled[a-1] = 0; } vector<int> reach(N, 0); reach[0] = 1; vector<int> I = {0}; rep(i,I.size()){ int p = I[i]; for(int e : E[p]) if(reach[e] == 0) if(enabled[e]){ reach[e] = 1; I.push_back(e); } } if(reach[G] == 0) cout << "No\n"; else cout << "Yes\n"; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;