# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
319913 | 2020-11-06T18:22:42 Z | knon0501 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 206 ms | 262148 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> a[100001]; long long dp[100001]; int chk[100001]; long long dfs(int v,int p){ if(chk[v])return dp[v]=0; vector<long long> b; for(auto u: a[v]){ if(u.first==p)continue; b.push_back(dfs(u.first,v)+u.second); } sort(b.begin(),b.end()); if(b.size()<=1)return 1e18; return dp[v]=b[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n=N; int i,j; for(i=0 ; i<K ; i++)chk[P[i]]=1; for(i=0 ; i<M ; i++){ int u=R[i][0]; int v=R[i][1]; a[u].push_back({v,L[i]}); a[v].push_back({u,L[i]}); } dfs(0,-1); return dp[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2924 KB | Output is correct |
6 | Correct | 3 ms | 2796 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2924 KB | Output is correct |
6 | Correct | 3 ms | 2796 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
9 | Runtime error | 206 ms | 262148 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 | 3 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2924 KB | Output is correct |
6 | Correct | 3 ms | 2796 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
9 | Runtime error | 206 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |