# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
757125 | 2023-06-12T16:53:02 Z | CpDark | Crocodile's Underground City (IOI11_crocodile) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; typedef long long ll; typedef pair<int, ll> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<pii> vp; typedef vector<vp> vvp; typedef vector<bool> vb; typedef vector<vb> vvb; vvp graph; vi isOut; ll dfs(int v, int p) { if (isOut[v])return 0; ll best1 = 0; ll best2 = 0; for (int i = 0;i < graph[v].size();i++) { int u = graph[v][i].first; ll w = graph[v][i].second; if (u != p) { ll curr = dfs(u, v) + w; if (curr <= best1) { if (best1 < best2) best2 = best1; best1 = curr; } else if (curr < best2) best2 = curr; } } return best2; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ graph.resize(N); isOut.resize(N); for (int i = 0;i < M;i++) { graph[R[i][0]].push_back({ R[i][1], L[i] }); graph[R[i][1]].push_back({ R[i][0], L[i] }); } for (int i = 0;i < K;i++) { isOut[P[i]] = true; } int ans = (int)dfs(0, 0); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |