Submission #1111373

#TimeUsernameProblemLanguageResultExecution timeMemory
1111373justin271828Drivers (BOI24_drivers)C++14
11 / 100
2079 ms1308 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N, M, U; cin >> N >> M >> U; vector<pair<int, int>> v[N]; int x, y, t; for (int i = 0; i < M; i++) { pair<int, int> p; cin >> x >> y >> t; x--; y--; p.first = y; p.second = t; v[x].push_back(p); p.first = x; v[y].push_back(p); } for (int i = 0; i < U; i++) { int a, b, maxi; bool visited[N]; memset(visited, false, sizeof(visited)); cin >> a >> b >> maxi; a--; b--; queue<int> q; q.push(a); visited[a] = true; bool possible = false; while (!q.empty()) { if (q.front() == b) { possible = true; break; } for (pair<int, int> p: v[q.front()]) { if (visited[p.first]) continue; if (p.second > maxi) continue; visited[p.first] = true; q.push(p.first); } q.pop(); } if (possible) cout << "TAIP\n"; else cout << "NE\n"; } return 0; }
#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...