# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
814259 | Hanksburger | Cyberland (APIO23_cyberland) | C++17 | 27 ms | 9452 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;
vector<pair<long long, long long> > adj[100005];
priority_queue<pair<long long, long long> > pq;
long long dist[100005], final[100005];
double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> a)
{
for (long long i=0; i<m; i++)
{
adj[x[i]].push_back({y[i], c[i]});
adj[y[i]].push_back({x[i], c[i]});
}
for (long long i=0; i<n; i++)
dist[i]=1e18;
dist[0]=0;
pq.push({0, 0});
while (!pq.empty())
{
long long u=pq.top().second;
pq.pop();
if (final[u])
continue;
final[u]=1;
for (long long i=0; i<adj[u].size(); i++)
{
long long v=adj[u][i].first, w=adj[u][i].second;
if (dist[u]+w<dist[v])
{
dist[v]=dist[u]+w;
pq.push({-dist[v], v});
}
}
}
if (dist[h]<5e17)
return dist[h];
else
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... |