Language: C++

#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const long long MOD = 998244353;

long long inq(long long x, long long y)
{
    if (y == 0) return 1;
    long long l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x % MOD;
    return l * l % MOD;
}

const double PI = acos(-1);
int x1, y1, x2, y2;
int n;
int x[500000], y[500000];
vector<pair<int, int> > a, b;
double ans;
int kek, LIM = 100000000;
int res = 0;

int comp(vector<int> ss)
{
    vector<int> dp(ss.size());
    for (int i = 0; i < ss.size(); i++)
    {
        dp[i] = 1;
        for (int j = 0; j < i; j++)
        {
            if (ss[j] < ss[i]) dp[i] = max(dp[i], dp[j] + 1);
        }
    }
    if (dp.size() == 0) return 0;
    return *max_element(all(dp));
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2)
    {
        ans = abs(y2 - y1);
        int t = 0;
        cin >> n;
        for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
        for (int i = 0; i < n; i++) if (x[i] == x1 && min(y1, y2) < y[i] && y[i] < max(y1, y2)) t = 1;
        if (t) ans = 100 * ans - 20 + 10 * PI;
        printf("%.9f", ans);
        return 0;
    }
    if (y1 == y2)
    {
        ans = abs(x2 - x1);
        int t = 0;
        cin >> n;
        for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
        for (int i = 0; i < n; i++) if (y[i] == y1 && min(x1, x2) < x[i] && x[i] < max(x1, x2)) t = 1;
        if (t) ans = 100 * ans - 20 + 10 * PI;
        printf("%.9f", ans);
        return 0;
    }
    if (x1 > x2)
    {
        swap(x1, x2);
        swap(y1, y2);
    }
    if (y1 > y2)
    {
        y1 = LIM - y1;
        y2 = LIM - y2;
        kek = 1;
    }
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
        if (kek) y[i] = LIM - y[i];
        if (x1 < x[i] && x[i] < x2 && y1 <= y[i] && y[i] <= y2)
        {
            a.push_back({y[i], x[i]});
        }
        if (x1 <= x[i] && x[i] <= x2 && y1 < y[i] && y[i] < y2)
        {
            b.push_back({x[i], y[i]});
        }
    }
    ans = y2 - y1 + x2 - x1;
    sort(all(a));
    sort(all(b));
    vector<int> c, d;
    for (int i = 0; i < a.size(); i++) c.push_back(a[i].second);
    for (int i = 0; i < b.size(); i++) d.push_back(b[i].second);
    int r1 = comp(c), r2 = comp(d);
    double alpha = 100 * ans - 20 * r1 + 5 * PI * r1;
    double betta = 100 * ans - 20 * r2 + 5 * PI * r2;
    if (r1 == y2 - y1 + 1) alpha += 5 * PI;
    if (r2 == x2 - x1 + 1) betta += 5 * PI;
    //printf("%.9f\n%.9f\n", alpha, betta);
    printf("%.12f", std::min(alpha, betta));
}


Compiler output:
a.cc:89:9: error: 'int y1' redeclared as different kind of entity
   89 | int x1, y1, x2, y2;
      |         ^~
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/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/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:117:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |     ~~~~~~~~~ ^~ ~~
      |         |        |
      |         |        double(double) noexcept
      |         std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/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:117:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
/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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(short int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(short unsigned int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(unsigned int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(long int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(long unsigned int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(long long int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(long long unsigned int)y1' 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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  double (*)(double) noexcept
a.cc:117:18: error: cannot bind rvalue '(void*)y1' 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:117:18: 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]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |
      |                  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_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:117:18: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
  117 |     cin >> x1 >> y1 >> x2 >> y2;
      |                  ^~
      |                  |