# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115519 | 2019-06-08T03:29:08 Z | arnold518 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 4 ms | 2688 KB |
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 100000; const ll INF = (1ll<<60); vector<pii> adj[MAXN+10]; pll dist[MAXN+10]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { int i, j; for(i=0; i<M; i++) { int u=R[i][0], v=R[i][1], w=L[i]; adj[u].push_back({v, w}); adj[v].push_back({u, w}); } queue<int> Q; for(i=0; i<N; i++) dist[i]={INF, INF}; for(i=0; i<K; i++) dist[P[i]]={0, 0}, Q.push(P[i]); while(!Q.empty()) { int now=Q.front(); Q.pop(); for(pii nxt : adj[now]) { if(dist[now].second+nxt.second<dist[nxt.first].second) { if(dist[now].second+nxt.second<dist[nxt.first].first) dist[nxt.first].second=dist[nxt.first].first, dist[nxt.first].first=dist[now].second+nxt.second; else dist[nxt.first].second=dist[now].second+nxt.second; Q.push(nxt.first); } } } return dist[0].second; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |