Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 2000;
const double c = 20.0 - 3.14159265358979323846 * 2 * 10 / 4.0;
const double C = 3.14159265358979323846 * 2 * 10 / 2.0 - 20.0;
int x1, y1, x2, y2;

int g(int y) {
	return abs(y1 - y);
}

struct point {
	int x, y;
	bool operator < (const point q) const {
		if(this->x < q.x && g(this->y) < g(q.y))return true;
		return false;
	}
	bool operator >= (const point q) const {
		if(this->x >= q.x && g(this->y) >= g(q.y))return true;
		return false;
	}
};

int binary_search(point key, point *g, int low, int high)
{
    while (low < high)
    {
        int mid = (low + high) >> 1;
        if (key >= g[mid])
            low = mid + 1;
        else
            high = mid;
    }
    return low;
}


point a[maxn], d[maxn];

bool cmp(point w, point q) {
	if(w.x < q.x)return true;
	else if(w.x == q.x)return g(w.y) < g(q.y);
	return false;
}
int main()
{	
	//freopen("in.txt","r",stdin);
    int n, j, len;
    cin>>x1>>y1>>x2>>y2;
    if(x1 > x2) {
    	swap(x1, x2);
    	swap(y1, y2);
	}
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		scanf("%d%d",&a[i].x,&a[i].y);
		if(a[i].x <= x2 && a[i].x >= x1 && 
		(ll)(a[i].y - y1) * (ll)(a[i].y - y2) <= 0)
			a[cnt++] = a[i];
	}
	sort(a, a + cnt, cmp);
    //memset(g, 0, sizeof(g));
    //cout<<cnt<<endl;
    d[1] = a[0], len = 1;//初始化子序列长度为1，最小右边界
    for (int i = 1; i < cnt; i++)
    {
        if (d[len] < a[i])//(如果允许子序列相邻元素相同 g[len]<=a[i],默认为不等）
            j = ++len; //a[i]>g[len],直接加入到g的末尾,且len++
        else
            j = binary_search(a[i], d, 1, len + 1);
        d[j] = a[i];//二分查找,找到第一个比a[i]小的数g[k],并g[k+1]=a[i]
    }
    if(cnt == 0)len = 0;
	//cout << len << endl;
	
	double ans = fabs(x1 - x2) + fabs(y1 - y2);
	ans = ans * 100.0;
	if(y1 != y2)ans -= len * c;
	else {
		len = 0;
		for(int i=0;i<cnt;i++) {
			if(a[i].y == y1)len++;
		}
		ans += len * C;
	}
	printf("%.13lf\n",ans);
    return 0;
}

Compiler output:
a.cc:7:9: error: 'int y1' redeclared as different kind of entity
    7 | 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/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:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int g(int)':
a.cc:10:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |         return abs(y1 - y);
      |                    ~~~^~~
a.cc:10:19: error: no matching function for call to 'abs(double (*)(double) noexcept)'
   10 |         return abs(y1 - y);
      |                ~~~^~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' (near match)
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/stdlib.h:980:12: note:   conversion of argument 1 would be ill-formed:
a.cc:10:23: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   10 |         return abs(y1 - y);
      |                    ~~~^~~
      |                       |
      |                       double (*)(double) noexcept
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' (near match)
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note:   conversion of argument 1 would be ill-formed:
a.cc:10:23: error: invalid conversion from 'double (*)(double) noexcept' to '__int128' [-fpermissive]
   10 |         return abs(y1 - y);
      |                    ~~~^~~
      |                       |
      |                       double (*)(double) noexcept
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' (near match)
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note:   conversion of argument 1 would be ill-formed:
a.cc:10:23: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
   10 |         return abs(y1 - y);
      |                    ~~~^~~
      |                       |
      |                       double (*)(double) noexcept
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' (near match)
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note:   conversion of argument 1 would be ill-formed:
a.cc:10:23: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
   10 |         return abs(y1 - y);
      |                    ~~~^~~
      |                       |
      |                       double (*)(double) noexcept
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const valarray<_Tp>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   template argument deduction/substitution failed:
a.cc:10:19: note:   mismatched types 'const std::valarray<_Tp>' and 'double (*)(double) noexcept'
   10 |         return abs(y1 - y);
      |                ~~~^~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const _Expr<_Dom1, typename _Dom1::value_type>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   template argument deduction/substitution failed:
a.cc:10:19: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'double (*)(double) noexcept'
   10 |         return abs(y1 - y);
      |                ~~~^~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:892:5: note: candidate: 'template<class _Tp> _Tp std::abs(const complex<_Tp>&)'
  892 |     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
      |     ^~~
/usr/include/c++/14/complex:892:5: note:   template argument deduction/substitution failed:
a.cc:10:19: note:   mismatched types 'const std::complex<_Tp>' and 'double (*)(double) noexcept'
   10 |         return abs(y1 - y);
      |                ~~~^~~~~~~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:137:18: note:   no known conversion for argument 1 from 'double (*)(double) noexcept' to '__float128'
  137 |   abs(__float128 __x)
      |       ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:19: note:   no known conversion for argument 1 from 'double (*)(double) noexcept' to 'long double'
   79 |   abs(long double __x)
      |       ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:13: note:   no known conversion for argument 1 from 'double (*)(double) noexcept' to 'float'
   75 |   abs(float __x)
      |       ~~~~~~^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:14: note:   no known conversion for argument 1 from 'double (*)(double) noexcept' to 'double'
   71 |   abs(double __x)
      |       ~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:50:12: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
   50 |     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/sstream:40,
                 from /usr/include/c++/14/complex:45:
/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:50:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
   50 |     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:50:14: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
   50 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
a.cc:50:14: 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:50:14: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
   50 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
a.cc:50:14: 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:50:14: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   50 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
a.cc:50:14: 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:50: