Language: C++

//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

int dp[200010];

VI xx, x, yy, y, unzipx(200010), unzipy(200010);
unordered_map<int, int> zipx, zipy;
VI compress() {
  x = xx;
  y = yy;
  sort(ALL(xx));
  sort(ALL(yy));
  xx.erase(unique(ALL(xx)), xx.end());
  xx.erase(unique(ALL(yy)), yy.end());
  REP(i, x.size()) {
    zipx[xx[i]] = i;
    unzipx[i] = xx[i];
  }
  REP(i, y.size()) {
    zipy[yy[i]] = i;
    unzipy[i] = yy[i];
  }
  REP(i, x.size()) {
    // cout << a[i];
    x[i] = zipx[x[i]];
  }
  REP(i, y.size()) {
    // cout << a[i];
    y[i] = zipy[y[i]];
  }
  return x;
}

PII xy[200010], xy1[200010];
int x1[200010], y1[200010];
signed main(void)
{
  int sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;
  if(sy > gy || (sy == gy && sx > gx)) {
    swap(sx, gx);
    swap(sy, gy);
  }
  int flag = 0;
  if(sx == gx) flag = 1;
  else if(sy == gy) flag = 2;
  bool f1 = false, f2 = false;
  int n;
  cin >> n;
  REP(i, n) {
    cin >> x1[i] >> y1[i];
    if(sx <= x1[i] && x1[i] <= gx && sy <= y1[i] && y1[i] <= gy) {
      xx.PB(x1[i]);
      yy.PB(y1[i]);
      // cout << "a" << endl;
    }
    if(flag == 1 && x1[i] == sx && sy <= y1[i] && y1[i] <= gy) f1 = true;
    if(flag == 2 && y1[i] == sy && sx <= x1[i] && x1[i] <= gx) f2 = true;
  }
  if(flag == 1) {
    if(f1) {
      cout << fixed << setprecision(15) << abs(gy-sy)*(double)100 - 20 + 10*PI << endl;
    } else {
      cout << fixed << setprecision(15) << abs(gy-sy)*(double)100 << endl;
    }
    return 0;
  } else if(flag == 2) {
    if(f2) {
      cout << fixed << setprecision(15) << abs(gx-sx)*(double)100 - 20 + 10*PI << endl;
    } else {
      cout << fixed << setprecision(15) << abs(gx-sx)*(double)100 << endl;
    }
    return 0;
  }
  n = xx.size();
  compress();
  REP(i, n) {
    // cout << x[i] << "," << y[i] << endl;
    xy[i] = {y[i], x[i]};
  }
  sort(xy, xy+n);
  // REP(i, n) cout << xy[i].first << "," << xy[i].second << endl;
  // int st = lower_bound(y1, y1+n, sy) - y1;
  // int fin = lower_bound(y1, y1+n, gy) - y1;
  fill(dp, dp+200010, INF);
  REP(i, n) {
    // if(xy[i].first > gy) break;
    *lower_bound(dp, dp+n, xy[i].second) = xy[i].second;
    // REP(j, n+5) cout << dp[j] << " "; cout << endl;
  }
  ll ret = lower_bound(dp, dp+n, INF) - dp;
  // cout << ret << endl;

  double r = 20-5*PI;
  double ans = (abs(gx-sx) + abs(gy-sy)) * 100;
  // cout << r << " " << ans << endl;
  cout << fixed << setprecision(15) << ans - ret * r << endl;

  return 0;
}


Compiler output:
a.cc:61:26: error: 'int y1 [200010]' redeclared as different kind of entity
   61 | int x1[200010], y1[200010];
      |                          ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:77:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   77 |     cin >> x1[i] >> y1[i];
      |                         ^
a.cc:77:18: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
   77 |     cin >> x1[i] >> y1[i];
      |     ~~~~~~~~~~~~ ^~ ~~~~~
      |         |               |
      |         |               double(double) noexcept
      |         std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(short int)(y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(short unsigned int)(y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(int)(y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(unsigned int)(y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(long int)(y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(long unsigned int)(y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(long long int)(y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(long long unsigned int)(y1 + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
a.cc:77:25: error: cannot bind rvalue '(void*)(y1 + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:7: note:   conversion of argument 1 would be ill-formed:
a.cc:77:25: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
   77 |     cin >> x1[i] >> y1[i];
      |                     ~~~~^
      |                         |
      |                         double (*)(double) noexcept
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_