Submission #984905

#TimeUsernameProblemLanguageResultExecution timeMemory
98490554skyxenonCrocodile's Underground City (IOI11_crocodile)C++14
46 / 100
4 ms4956 KiB
// https://oj.uz/problem/view/IOI11_crocodile /** Needed for linking!!! */ #include "crocodile.h" #include <bits/stdc++.h> using namespace std; #define INF 2000000000 vector<map<int, int>> graph; vector<bool> is_exit; vector<bool> visited; int dfs(int curr) { if (is_exit[curr]) { return 0; } vector<int> distances; for (auto [nei, weight] : graph[curr]) { if (!visited[nei]) { visited[nei] = true; distances.push_back(min(INF, weight + dfs(nei))); } else { distances.push_back(INF); } } sort(distances.begin(), distances.end()); assert(distances.size() > 1); return distances[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { graph.resize(N); is_exit.resize(N); visited.resize(N); for (int i = 0; i < M; i++) { graph[R[i][0]][R[i][1]] = graph[R[i][1]][R[i][0]] = L[i]; } for (int i = 0; i < K; i++) { is_exit[P[i]] = true; } visited[0] = true; return dfs(0); }

Compilation message (stderr)

crocodile.cpp: In function 'int dfs(int)':
crocodile.cpp:21:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |     for (auto [nei, weight] : graph[curr]) {
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...