# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630178 | 2022-08-15T20:21:39 Z | NintsiChkhaidze | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2 ms | 2644 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |