# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630178 | NintsiChkhaidze | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2 ms | 2644 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 "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define s second
#define pb push_back
#define f first
const int nn = 100005;
vector <pair<int,int> > v[nn];
int dis[nn];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
for (int i = 0; i < M; i++){
v[R[i][0]].pb({R[i][1],L[i]});
v[R[i][1]].pb({R[i][0],L[i]});
}
for (int i = 1; i < N; i++)
dis[i] = 1e9;
priority_queue< pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,0});
dis[0] = 0;
while(pq.size()){
int x = pq.top().s,d = pq.top().f;
pq.pop();
if (dis[x] != d) continue;
for (auto [to,w]: v[x]){
if (dis[to] > d + w){
dis[to] = d + w;
pq.push({dis[to],to});
}
}
}
int ans = 0;
for (int i = 0; i < K; i++)
ans = max(ans, dis[P[i]]);
return ans;
}
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... |