Submission #220518

#TimeUsernameProblemLanguageResultExecution timeMemory
220518anonymousCrocodile's Underground City (IOI11_crocodile)C++14
89 / 100
407 ms40748 KiB
#include "crocodile.h" #include <iostream> #include <vector> #define MAXN 1005 using namespace std; vector<pair<int,int> > adj[MAXN]; int dp[MAXN]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for (int i=0; i<N; i++) { dp[i] = 1e9 + 10; } for (int i=0; i<K; i++) { dp[P[i]]=0; } for (int i=0; i<M; i++) { adj[R[i][0]].push_back({R[i][1], L[i]}); adj[R[i][1]].push_back({R[i][0], L[i]}); } for (int j=0; j<N; j++) { for (int i=0; i<N; i++) { int Min=1e9 + 10, Smin = 1e9+10; for (auto v: adj[i]) { if (dp[v.first] + v.second < Min) { Smin = Min; Min = dp[v.first] + v.second; } else if (dp[v.first] + v.second < Smin) { Smin = dp[v.first] + v.second; } } dp[i] = min(dp[i], Smin); } } return(dp[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...