# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1111560 |
2024-11-12T09:36:42 Z |
YSH2020 |
Drivers (BOI24_drivers) |
C++17 |
|
2000 ms |
392772 KB |
#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});
}
int ans[n+5][n+5];
for (int i = 1; i <= n; i++) {
//dijkstra from here?
for (int j =1; j <= n; j++) ans[i][j] = 1000000500;
ans[i][i] = 0;
priority_queue <pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
pq.push({0, i});
while (pq.size() > 0) {
auto tmp = pq.top();
pq.pop();
if (tmp.first > ans[i][tmp.second]) continue;
ans[i][tmp.second] = tmp.first;
for (auto k:edges[tmp.second]) {
if (max(tmp.first, k.second) < ans[i][k.first]) {ans[i][k.first] = max(tmp.first, k.second); pq.push({max(tmp.first, k.second), k.first});}
}
}
}
while (u--) {
int x, y, z; cin >> x >> y >> z;
if (ans[x][y] > z) cout << "NE" << '\n';
else cout << "TAIP" << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
1184 KB |
Output is correct |
3 |
Correct |
200 ms |
231572 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Execution timed out |
2086 ms |
392572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
4 ms |
336 KB |
Output is correct |
4 |
Correct |
4 ms |
336 KB |
Output is correct |
5 |
Correct |
4 ms |
336 KB |
Output is correct |
6 |
Correct |
4 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
336 KB |
Output is correct |
8 |
Correct |
56 ms |
1360 KB |
Output is correct |
9 |
Correct |
14 ms |
1272 KB |
Output is correct |
10 |
Correct |
401 ms |
9484 KB |
Output is correct |
11 |
Correct |
216 ms |
4432 KB |
Output is correct |
12 |
Correct |
266 ms |
4664 KB |
Output is correct |
13 |
Correct |
208 ms |
231688 KB |
Output is correct |
14 |
Correct |
132 ms |
108804 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
2 ms |
336 KB |
Output is correct |
17 |
Correct |
2 ms |
336 KB |
Output is correct |
18 |
Correct |
69 ms |
4448 KB |
Output is correct |
19 |
Execution timed out |
2093 ms |
392772 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
1184 KB |
Output is correct |
3 |
Correct |
200 ms |
231572 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Execution timed out |
2086 ms |
392572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
1184 KB |
Output is correct |
3 |
Correct |
200 ms |
231572 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Execution timed out |
2086 ms |
392572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
1184 KB |
Output is correct |
3 |
Correct |
200 ms |
231572 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Execution timed out |
2086 ms |
392572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |