Submission #821735

# Submission time Handle Problem Language Result Execution time Memory
821735 2023-08-11T14:23:10 Z nemethm Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
2 ms 2644 KB
    #include "crocodile.h"
    #include <bits/stdc++.h>
     
    using namespace std;
    using ll = long long int;
     
    vector<pair<int,ll>> g[100100];
     
    ll dist[100100] = {0};
     
    void dfs(int node, int prev = -1){
      for(auto i : g[node]){
        if(i.first != prev){
          dist[i.first] = dist[node] + i.second;
          dfs(i.first, node);
        }
      }
    }
     
    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]].push_back({R[i][1], L[i]});
        g[R[i][1]].push_back({R[i][0], L[i]});
      }
      dfs(0);
      ll ans = 0;
      for(int i = 0; i < K; ++i){
        ans = max(ans, dist[P[i]]);
      }
      return ans;
    }
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -