# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
735882 | 2023-05-04T22:21:31 Z | tigar | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2 ms | 2644 KB |
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; typedef long long ll; ll INF=LONG_MAX; vector<pair<ll, ll> >graff[100010]; bool izlaz[100010], check[100010]; int T[100010]; void dfs(int v) { if(check[v])return; check[v]=true; if(izlaz[v]){T[v]=0; return;} ll m1=INF, m2=INF; for(int i=0; i<graff[v].size(); i++) { dfs(graff[v][i].first); ll xx=T[graff[v][i].first]+graff[v][i].second; if(xx<m1){m2=m1; m1=xx;} else if(xx>=m1 and xx<=m2){m2=xx;} } T[v]=m2; return; } int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { for(int i=0; i<m; i++) { graff[r[i][0]].push_back({r[i][1], l[i]}); graff[r[i][1]].push_back({r[i][0], l[i]}); } for(int i=0; i<k; i++)izlaz[p[i]]=true; for(int i=0; i<n; i++)T[i]=INF; dfs(0); return T[0]; }
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 | - |