# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
511427 | AdamGS | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 478 ms | 98416 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;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7, INF=1e9+7;
vector<pair<int,ll>>V[LIM];
ll mi[LIM], odw[LIM];
int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]) {
rep(i, n) mi[i]=INF;
rep(i, m) {
V[R[i][0]].pb({R[i][1], L[i]});
V[R[i][1]].pb({R[i][0], L[i]});
}
priority_queue<pair<ll,int>>q;
rep(i, k) q.push({0, P[i]});
while(!q.empty()) {
ll o=-q.top().st, a=q.top().nd; q.pop();
if(odw[a]) continue;
odw[a]=1;
if(!a) return o;
for(auto i : V[a]) {
if(o+i.nd<=mi[i.st]) {
if(mi[i.st]!=INF) q.push({-mi[i.st], i.st});
mi[i.st]=o+i.nd;
} else {
q.push({-o-i.nd, i.st});
}
}
}
}
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... |