Submission #428555

#TimeUsernameProblemLanguageResultExecution timeMemory
428555pavementPark (JOI17_park)C++17
Compilation error
0 ms0 KiB
#include "park.h" #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back static int Place[1405], link[1405], sz[1405]; int find(int x) { if (x == link[x]) return x; return link[x] = find(link[x]); } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return; if (sz[b] > sz[a]) swap(a, b); sz[a] += sz[b]; link[b] = a; } void solve(int l, int r) { if (find(l) == find(r)) return; int lo = 0, hi = N - 1, ans = -1; while (lo <= hi) { int mid = (lo + hi) / 2; memset(Place, 0, sizeof Place); for (int i = 0; i <= mid; i++) Place[i] = 1; Place[l] = Place[r] = 1; if (l >= r ? Ask(r, l, Place) : Ask(l, r, Place)) ans = mid, hi = mid - 1; else lo = mid + 1; } if (ans == 0) { l >= r ? Answer(r, l) : Answer(l, r); unite(l, r); } else { solve(l, ans); solve(ans, r); } }

Compilation message (stderr)

park.cpp: In function 'void solve(int, int)':
park.cpp:26:19: error: 'N' was not declared in this scope
   26 |  int lo = 0, hi = N - 1, ans = -1;
      |                   ^
park.cpp:33:53: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |   if (l >= r ? Ask(r, l, Place) : Ask(l, r, Place)) ans = mid, hi = mid - 1;
      |                                                     ^~~
      |                                                     abs
park.cpp:36:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |  if (ans == 0) {
      |      ^~~
      |      abs