# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86571 | 2018-11-26T15:53:10 Z | tjdgus4384 | None (KOI16_gas) | C++14 | 1284 ms | 66560 KB |
#include<cstdio> #include<vector> #include<string.h> #include<algorithm> #include<queue> using namespace std; typedef pair<int, int> pi; typedef pair<pair<int, int>, int> ppi; int p[2501], dist[2501]; vector<pi> v[2501]; priority_queue<ppi , vector<ppi>, greater<ppi> > pq; int main() { int n, m, a, b, c; scanf("%d %d", &n, &m); for(int i = 1;i <= n;i++) scanf("%d", &p[i]); for(int i = 0;i < m;i++) { scanf("%d %d %d", &a, &b, &c); v[a].push_back({b, c}); v[b].push_back({a, c}); } //dijkstra //(지금까지돈, 도시, 지금까지최소기름값) pq.push({{0, 1}, p[1]}); memset(dist, -1, sizeof(dist)); dist[1] = 0; while(!pq.empty()) { int s = pq.top().first.first; int f = pq.top().first.second; int t = pq.top().second; pq.pop(); if(dist[f] == -1) dist[f] = s; else dist[f] = min(dist[f], s); if(f == n) { printf("%d", dist[f]); return 0; } for(int i = 0;i < v[f].size();i++) { pq.push({{s + t * v[f][i].second, v[f][i].first}, min(t, p[v[f][i].first])}); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 424 KB | Output is correct |
5 | Correct | 2 ms | 612 KB | Output is correct |
6 | Runtime error | 605 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1284 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1272 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 424 KB | Output is correct |
5 | Correct | 2 ms | 612 KB | Output is correct |
6 | Runtime error | 605 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 424 KB | Output is correct |
5 | Correct | 2 ms | 612 KB | Output is correct |
6 | Runtime error | 605 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |