#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;
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;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |