Submission #1111547

#TimeUsernameProblemLanguageResultExecution timeMemory
1111547YSH2020Drivers (BOI24_drivers)C++17
11 / 100
2075 ms1268 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, m, u; cin >> n >> m >> u; vector <vector<pair<int, int>>> edges; vector<pair<int, int>> empty; for (int i= 0; i < n+5; i++) edges.push_back(empty); for (int i = 0; i < m; i++) { int x, y, z; cin >> x >> y >> z; edges[x].push_back({y, z}); edges[y].push_back({x, z}); } while (u--) { int x, y, z; cin >> x >> y >> z; int visit[n+5]; for (int i=1; i<=n;i++) visit[i] = 0; queue<int> tmp; tmp.push(x); visit[x] = 1; while (visit[y] == 0 and tmp.size() > 0) { auto cur = tmp.front(); tmp.pop(); for (auto i:edges[cur]) { if (i.second <= z and visit[i.first] == 0) {tmp.push(i.first); visit[i.first] = 1;} } } if (visit[y] == 0) cout << "NE" << '\n'; else cout << "TAIP" << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...