Submission #1174845

#TimeUsernameProblemLanguageResultExecution timeMemory
1174845achinhchinCrocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include "crocodile.h" #include <algorithm> #include <vector> #include <queue> #include <utility> #include <iostream> using namespace std; typedef long long ll; #define f first #define s second vector<pair<ll, ll> > a[100000]; priority_queue<pair<ll, ll> > b; pair<ll, ll> d[100000]; ll t, mn = LONG_LONG_MAX, i, c[100000], ds; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { while (M--) a[R[M][0]].push_back(make_pair(L[M], R[M][1])), a[R[M][1]].push_back(make_pair(L[M], R[M][0])); for (i = 1; i < N; i++) c[i] = LONG_LONG_MAX; b.push(make_pair(0, 0)); while (!b.empty()) { t = b.top().s, b.pop(), ds = 0; for (auto i: a[t]) if (c[t] + i.f < c[i.s]) d[ds++] = make_pair(c[t] + i.f, i.s); sort(d, d + ds); for (i = 1; i < ds; i++) c[d[i].s] = d[i].f, b.push(d[i]); }while (K--) mn = min(mn, c[P[K]]); return mn; }

Compilation message (stderr)

crocodile.cpp:13:102: error: 'LONG_LONG_MAX' was not declared in this scope
   13 | vector<pair<ll, ll> > a[100000]; priority_queue<pair<ll, ll> > b; pair<ll, ll> d[100000]; ll t, mn = LONG_LONG_MAX, i, c[100000], ds;
      |                                                                                                      ^~~~~~~~~~~~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:16:8: error: 'i' was not declared in this scope
   16 |   for (i = 1; i < N; i++) c[i] = LONG_LONG_MAX; b.push(make_pair(0, 0));
      |        ^
crocodile.cpp:16:27: error: 'c' was not declared in this scope
   16 |   for (i = 1; i < N; i++) c[i] = LONG_LONG_MAX; b.push(make_pair(0, 0));
      |                           ^
crocodile.cpp:16:34: error: 'LONG_LONG_MAX' was not declared in this scope
   16 |   for (i = 1; i < N; i++) c[i] = LONG_LONG_MAX; b.push(make_pair(0, 0));
      |                                  ^~~~~~~~~~~~~
crocodile.cpp:18:29: error: 'ds' was not declared in this scope; did you mean 'd'?
   18 |     t = b.top().s, b.pop(), ds = 0;
      |                             ^~
      |                             d
crocodile.cpp:19:28: error: 'c' was not declared in this scope
   19 |     for (auto i: a[t]) if (c[t] + i.f < c[i.s]) d[ds++] = make_pair(c[t] + i.f, i.s);
      |                            ^
crocodile.cpp:20:27: error: 'i' was not declared in this scope
   20 |     sort(d, d + ds); for (i = 1; i < ds; i++) c[d[i].s] = d[i].f, b.push(d[i]);
      |                           ^
crocodile.cpp:20:47: error: 'c' was not declared in this scope
   20 |     sort(d, d + ds); for (i = 1; i < ds; i++) c[d[i].s] = d[i].f, b.push(d[i]);
      |                                               ^
crocodile.cpp:21:29: error: 'c' was not declared in this scope
   21 |   }while (K--) mn = min(mn, c[P[K]]);
      |                             ^