# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64661 | 2018-08-05T10:35:03 Z | zetapi | Crocodile's Underground City (IOI11_crocodile) | C++14 | 870 ms | 263168 KB |
#include <crocodile.h> #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e6; const int INF=1e12; vector<pii> vec[MAX]; ll dp[MAX]; void dfs(int node,int par) { if(vec[node].size()==1 and vec[node][0].first==par) return ; int f=INF,s=INF; for(auto A:vec[node]) { if(A.first==par) continue; dfs(A.first,node); if(dp[A.first]+A.second<s) s=dp[A.first]+A.second; if(f>s) swap(f,s); } dp[node]=s; return ; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int A=0;A<M;A++) { vec[R[A][0]].pb(mp(R[A][1],L[A])); vec[R[A][1]].pb(mp(R[A][0],L[A])); } for(int A=0;A<N;A++) { if(vec[A].size()>1) { dfs(A,-1); return dp[A]; } } } /*signed main() { ios_base::sync_with_stdio(false); return 0; }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 23800 KB | Output is correct |
2 | Correct | 28 ms | 24040 KB | Output is correct |
3 | Correct | 24 ms | 24100 KB | Output is correct |
4 | Correct | 24 ms | 24136 KB | Output is correct |
5 | Correct | 27 ms | 24136 KB | Output is correct |
6 | Correct | 28 ms | 24180 KB | Output is correct |
7 | Correct | 28 ms | 24180 KB | Output is correct |
8 | Correct | 25 ms | 24180 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 23800 KB | Output is correct |
2 | Correct | 28 ms | 24040 KB | Output is correct |
3 | Correct | 24 ms | 24100 KB | Output is correct |
4 | Correct | 24 ms | 24136 KB | Output is correct |
5 | Correct | 27 ms | 24136 KB | Output is correct |
6 | Correct | 28 ms | 24180 KB | Output is correct |
7 | Correct | 28 ms | 24180 KB | Output is correct |
8 | Correct | 25 ms | 24180 KB | Output is correct |
9 | Runtime error | 870 ms | 263168 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 23800 KB | Output is correct |
2 | Correct | 28 ms | 24040 KB | Output is correct |
3 | Correct | 24 ms | 24100 KB | Output is correct |
4 | Correct | 24 ms | 24136 KB | Output is correct |
5 | Correct | 27 ms | 24136 KB | Output is correct |
6 | Correct | 28 ms | 24180 KB | Output is correct |
7 | Correct | 28 ms | 24180 KB | Output is correct |
8 | Correct | 25 ms | 24180 KB | Output is correct |
9 | Runtime error | 870 ms | 263168 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |