# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003306 | 2024-06-20T08:51:31 Z | vjudge1 | Crocodile's Underground City (IOI11_crocodile) | C++17 | 0 ms | 348 KB |
#include "crocodile.h" #include<bits/stdc++.h> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define f first #define s second #define pb push_back #define p_b pop_back using namespace std; const int sz = 1e3+5; vector<pii>g[sz]; int vis[sz], dist[sz], ans = 0, ext[sz], R[sz][2]; bool flag = false; void dfs(int node) { if(flag) return; vis[node] = 1; vector<pll>vect; ll k = 0; for(auto u : g[node]) { if(vis[u.f]) continue; dist[u.f] = dist[node] + u.s; if(ext[u.f]) k++; vect.pb({dist[u.f], u.f}); } sort(all(vect)); if(k <= 1){ for(auto u : vect) { if(vis[u.s]) continue; dfs(u.f); } } else { if(flag) return; ll cnt = 0; for(auto u : vect) { if(ext[u.s]) cnt++; if(cnt == 2) { ans = u.f; flag = true; return; } } } } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i < M; i++) { g[R[i][0]].pb({R[i][1], L[i]}); g[R[i][1]].pb({R[i][0], L[i]}); } for(int i = 0; i < K; i++) ext[P[i]] = 1; int res = 0; dfs(0); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |