Submission #984861

#TimeUsernameProblemLanguageResultExecution timeMemory
98486154skyxenonCrocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
// https://oj.uz/problem/view/IOI11_crocodile #include <bits/stdc++.h> using namespace std; #define int long long 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(weight + dfs(nei)); } } sort(distances.begin(), distances.end()); 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:29:65: error: expected ',' or '...' before 'P'
   29 | int travel_plan(int N, int M, int R[][2], int L[], int K, int[] P) {
      |                                                                 ^
crocodile.cpp: In function 'long long int travel_plan(long long int, long long int, long long int (*)[2], long long int*, long long int, long long int*)':
crocodile.cpp:39:17: error: 'P' was not declared in this scope
   39 |         is_exit[P[i]] = true;
      |                 ^