Submission #709647

#TimeUsernameProblemLanguageResultExecution timeMemory
709647therealpainCrocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; vector <pair <int, int>> adj[N]; bool special[N]; int n, m, k; namespace sub2 { long long d[N][2]; struct state { long long dist; int u, t; bool operator < (const state &other) const { return dist > other.dist; } }; long long solve() { priority_queue <state> heap; memset(d, 0x3f, sizeof d); for (int i = 0; i < n; ++i) { if (special[i] == false) continue; d[i][0] = d[i][1] = 0; heap.push({0, i, 0}); } while (heap.size()) { auto [dist, u, t] = heap.top(); heap.pop(); if (dist != d[u][t]) continue; for (auto [v, w] : adj[u]) { if (d[v][0] > dist + w) { if (d[v][0] < (long long) 1e18) { d[v][1] = d[v][0]; heap.push({d[v][1], v, 1}); } d[v][0] = dist + w; } else if (d[v][1] > dist + w) { d[v][1] = dist + w; heap.push({dist + w, v, 1}); } } } return d[0][1]; } } long long travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; m = M; k = K; for (int i = 0; i < m; ++i) { int u = R[i][0], v = R[i][1], w = L[i]; adj[u].emplace_back(v, w); adj[v].emplace_back(u, w); } for (int i = 0; i < k; ++i) { int x; cin >> x; special[x] = true; } long long ans = sub2::solve(); return ans; }

Compilation message (stderr)

crocodile.cpp:57:11: error: ambiguating new declaration of 'long long int travel_plan(int, int, int (*)[2], int*, int, int*)'
   57 | long long travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
      |           ^~~~~~~~~~~
In file included from crocodile.cpp:1:
crocodile.h:1:5: note: old declaration 'int travel_plan(int, int, int (*)[2], int*, int, int*)'
    1 | int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]);
      |     ^~~~~~~~~~~