Submission #449868

#TimeUsernameProblemLanguageResultExecution timeMemory
449868KarliverCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include "crocodile.h" #include <bits/stdc++.h> #define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x) #define all(v) (v).begin(), (v).end() using namespace std; #define forn(i,n) for (int i = 0; i < (n); ++i) #define rforn(i, n) for(int i = (n) - 1;i >= 0;--i) using ll = long long; int mod = (ll)1e9 + 7; #define PI acos(-1) typedef pair<int, int> pairs; const int INF = 1e9 + 100; const int N = 2e5 + 100; const double eps = 1e-7; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <typename XPAX> void ckma(XPAX &x, XPAX y) { x = (x < y ? y : x); } template <typename XPAX> void ckmi(XPAX &x, XPAX y) { x = (x > y ? y : x); } V<pairs> g[N]; int dis[N][2]; int travel_plan(int n, int m, int R[][2], int L[], int K, int P[]) { forn(i, n) dis[i][0] = dis[i][1] = INF; forn(i, m) { g[R[i][0]].emplace_back(R[i][1], L[i]); g[R[i][1]].emplace_back(R[i][0], L[i]); } priority_queue<pairs, V<pairs>, greater<pairs>> q; V<int> vis(n, 0); forn(i, K) { q.emplace(0, P[i]); vis[v] = 1; dis[P[i]][0] = dis[P[i]][1] = 0; } while(q.size()) { auto [s, v] = q.top(); q.pop(); if(vis[v] == 2)continue; ++vis[v]; if(vis[v] == 1)continue; for(auto [i, w] : g[v]) { int x = s + w; if(exit[i])continue; if(x < dis[i][0]) { swap(dis[i][1], dis[i][0]); dis[i][0] = x; q.emplace(x, i); } else if(x < dis[i][1]) { dis[i][1] = x; q.emplace(x, i); } } } return dis[0][1]; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:47:9: error: 'v' was not declared in this scope
   47 |     vis[v] = 1;
      |         ^
crocodile.cpp:52:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   52 |     auto [s, v] = q.top();
      |          ^
crocodile.cpp:58:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   58 |     for(auto [i, w] : g[v]) {
      |              ^
crocodile.cpp:60:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |       if(exit[i])continue;
      |                ^