# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984762 | 2024-05-17T05:11:05 Z | Rafiullah | Cyberland (APIO23_cyberland) | C++17 | 42 ms | 12636 KB |
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { map<int,vector<int>> graph; map<pair<int,int>,int> weight; for(int i = 0 ;i <x.size() ;i ++){ int a = x[i]; int b = y[i]; int cc = c[i]; weight[{min(a,b),max(a,b)}] = cc; graph[a].push_back(b); graph[b].push_back(a); } int dist[N]; for(int i = 1 ;i <N ;i ++)dist[i] = 1e9; dist[0] = 0; priority_queue<pair<int,int>> pq; pq.push({0,0}); while(pq.size()>0){ int node = pq.top().second; pq.pop(); for(int child:graph[node]){ int w = weight[{min(child,node),max(child,node)}]; if(w+dist[node]<dist[child]){ dist[child] = w+dist[node]; pq.push({-dist[child],child}); } } } if(dist[H] == 1e9)dist[H] = -1; return dist[H]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 604 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 700 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 856 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 42 ms | 12636 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 668 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 604 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 600 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 604 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |