Submission #1111369

# Submission time Handle Problem Language Result Execution time Memory
1111369 2024-11-12T07:48:40 Z justin271828 Drivers (BOI24_drivers) C++14
0 / 100
1 ms 340 KB
#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;

}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -