# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
750483 | Gurban | Cyberland (APIO23_cyberland) | C++17 | 40 ms | 7588 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18;
const int maxn=1e5+5;
// const double eps = 0.00000001;
int D[maxn];
vector<pair<int,ll>>E[maxn];
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
for(int i = 0;i < N;i++) E[i].clear();
for(int i = 0;i < M;i++){
E[x[i]].push_back({y[i],c[i]});
E[y[i]].push_back({x[i],c[i]});
}
arr[0] = 0;
ll ans = inf;
priority_queue<pair<ll,int>>q;
vector<ll>dis(N,inf);
vector<bool>vis(N,0);
dis[H] = 0;
q.push({0,H});
while(!q.empty()){
int x = q.top().second;
q.pop();
if(arr[x] == 0) return dis[x];
if(vis[x]) continue;
vis[x] = 1;
for(auto i : E[x]){
if(dis[i.first] > dis[x] + i.second){
dis[i.first] = dis[x] + i.second;
q.push({-dis[i.first],i.first});
}
}
}
// ans = dis[0];
// for(int i = 0;i < N;i++) if(arr[i] == 0) ans = min(ans,dis[i]);
return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |