# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783568 | 2023-07-15T04:17:24 Z | Sir_Ahmed_Imran | Crocodile's Underground City (IOI11_crocodile) | C++17 | 3 ms | 3060 KB |
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define MAXN 100001 ll dp[MAXN]; bool x[MAXN]; bool v[MAXN]; vector<pair<int,ll>> a[MAXN]; void dfs(int n,int m){ v[n]=1; if(x[n]) return; ll p=1e9+7; ll q=1e9+7; for(auto& i:a[n]){ if(i.ff==m) continue; if(!v[i.ff]) dfs(i.ff,n); if(dp[i.ff]+i.ss<p){ q=p; p=dp[i.ff]+i.ss; } else q=min(q,dp[i.ff]+i.ss); } dp[n]=q; } int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]){ for(int i=0;i<n;i++){ a[i]={}; v[i]=x[i]=dp[i]=0; } for(int i=0;i<m;i++){ a[R[i][0]].push_back({R[i][1],L[i]}); a[R[i][1]].push_back({R[i][0],L[i]}); } for(int i=0;i<k;i++) x[P[i]]=1; dfs(0,-1); return dp[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2660 KB | Output is correct |
3 | Correct | 2 ms | 2604 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2668 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2660 KB | Output is correct |
3 | Correct | 2 ms | 2604 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2668 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2800 KB | Output is correct |
9 | Incorrect | 3 ms | 3060 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2660 KB | Output is correct |
3 | Correct | 2 ms | 2604 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2668 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2800 KB | Output is correct |
9 | Incorrect | 3 ms | 3060 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |