Language: C++

#include <bits/stdc++.h>

using namespace std;
const long double pi = acos(-1);
const long long inf = 1e9;
const int maxn = 3e5;
pair<int,int> a[maxn];
int d[maxn];
int xn, xk, yn, yk, n;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> xn >> yn >> xk >> yk;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
    if (xn > xk) {
        for (int i = 1; i <= n; i++) a[i].first *= -1;
        xn *= -1;
        xk *= -1;
    }
    if (yn > yk) {
        for (int i = 1; i <= n; i++) a[i].second *= -1;
        yn *= -1;
        yk *= -1;
    }
    sort(a + 1, a + n + 1);
    long double ans = abs(xn - xk) + abs(yn - yk);
    ans *= 100;
    d[0] = -inf;
    int mx = 0;
    for (int i = 1; i <= n; i++) d[i] = inf;
    for (int i = 1; i <= n; i++) {
        if (a[i].first < xn || a[i].first > xk || a[i].second < yn || a[i].second > yk) continue;
        int j = upper_bound(d, d + n + 1, a[i].second) - d;
        if (d[j - 1] < a[i].second && a[i].second < d[j]) {
            d[j] = a[i].second;
            mx = max(mx, j);
        }
    }
    if (xn - xk == 0 && mx == 1) {
        ans += -20 + 2 * pi * 10 / 2;
    }
    else
    if (yn - yk == 0 && mx == 1) {
        ans += -20 + 2 * pi * 10 / 2;
    }
    else
    if (xn - xk == 1 && mx == 2) {
        ans += -20 + 2 * pi * 10 / 2 - (20 - 2 * pi * 10 / 4);
    }
    else
    if (yn - yk == 1 && mx == 2) {
        ans += -20 + 2 * pi * 10 / 2 - (20 - 2 * pi * 10 / 4);

    }
    else
    ans -= mx * (20 - 2 * pi * 10 / 4);
    cout.precision(20);
    cout << fixed << ans << "\n";
    return 0;
}


Compiler output:
a.cc:9:13: error: 'int yn' redeclared as different kind of entity
    9 | int xn, xk, yn, yk, n;
      |             ^~
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:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:258:1: note: previous declaration 'double yn(int, double)'
  258 | __MATHCALL (yn,, (int, _Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:12:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(int, double) noexcept')
   12 |     cin >> xn >> yn >> xk >> yk;
      |     ~~~~~~~~~ ^~ ~~
      |         |        |
      |         |        double(int, 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:12:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(int, double) noexcept'
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
/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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'short int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(short int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'short unsigned int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(short unsigned int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'unsigned int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(unsigned int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'long int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(long int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'long unsigned int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(long unsigned int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'long long int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(long long int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'long long unsigned int' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(long long unsigned int)yn' 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:12:18: error: invalid conversion from 'double (*)(int, double) noexcept' to 'void*' [-fpermissive]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, double) noexcept
a.cc:12:18: error: cannot bind rvalue '(void*)yn' 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:12:18: error: invalid conversion from 'double (*)(int, 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]
   12 |     cin >> xn >> yn >> xk >> yk;
      |                  ^~
      |                  |
      |                  double (*)(int, 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_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
  126 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:126:7: note:   conversion of argument 1 would be ill-formed:
a.cc:12:18: error: invali