제출 #1111412

#제출 시각아이디문제언어결과실행 시간메모리
1111412justin271828Trains (BOI24_trains)C++14
0 / 100
4 ms2652 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...