Language: C++

#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int x1, y1, x2, y2;
int n;
VP V;
double PI = acos(-1.);

int LIS(VI a) {
	int n = SZ(a);
	VI d(n + 10, 1000000000);
	d[0] = -1000000000;

	int ret = 0;
	for (int i = 0; i < n; i++) {
		int j = int(upper_bound(d.begin(), d.end(), a[i]) - d.begin());
		ret = MAX(ret, j);
		d[j] = a[i];
	}
	return ret;
}

void conv(int& x, int &y) {
	int xd = y;
	int yd = 100000000 - x;
	x = xd;
	y = yd;
}

double solve() {
	if (x1 == x2) {
		for (int i = 0; i < n; i++) {
			if (V[i].first == x1 && IN(V[i].second, MIN(y1, y2), MAX(y1, y2))) {
				return ABS(y2 - y1) * 100.0 - 20 + PI * 10;
			}
		}
		return ABS(y2 - y1) * 100.0;
	}

	if (y1 == y2) {
		for (int i = 0; i < n; i++) {
			if (V[i].second == y1 && IN(V[i].first, MIN(x1, x2), MAX(x1, x2))) {
				return ABS(x2 - x1) * 100.0 - 20 + PI * 10;
			}
		}
		return ABS(x2 - x1) * 100.0;
	}

	if (x1 > x2 && y1 > y2) {
		swap(x1, x2);
		swap(y1, y2);
	}

	if (x1 < x2 && y1 < y2);
	else {
		conv(x1, y1);
		conv(x2, y2);
		for (int i = 0; i < n; i++) {
			conv(V[i].first, V[i].second);
		}
		return solve();
	}

	VP Z;
	for (int i = 0; i < n; i++) {
		if (IN(V[i].first, x1, x2) && IN(V[i].second, y1, y2)) {
			Z.push_back(V[i]);
		}
	}

	sort(ALL(Z));
	VI X;
	for (PII p : Z) X.push_back(p.second);
	int lis = LIS(X);
	double ret = ABS(x1 - x2) * 100.0 + ABS(y1 - y2) * 100.0 - lis * 20 + lis * PI * 10 / 2;
	//printf("lis=%d\n", lis);
	return ret;
}

int main()
{
	scanf("%d %d %d %d %d", &x1, &y1, &x2, &y2, &n);
	for (int i = 0; i < n; i++) {
		int xx, yy;
		scanf("%d %d", &xx, &yy);
		V.push_back({ xx, yy });
	}
	double ans = solve();
	printf("%.15lf\n", ans);
	return 0;
}


Compiler output:
a.cc:47:9: error: 'int y1' redeclared as different kind of entity
   47 | 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/list:60,
                 from a.cc:3:
/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 'double solve()':
a.cc:27:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
      |                    ~~~~^~~~~
a.cc:34:24: note: in definition of macro 'IN'
   34 | #define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
      |                        ^
a.cc:76:65: note: in expansion of macro 'MIN'
   76 |                         if (V[i].first == x1 && IN(V[i].second, MIN(y1, y2), MAX(y1, y2))) {
      |                                                                 ^~~
a.cc:27:30: error: operands to '?:' have different types 'double (*)(double) noexcept' and 'int'
   27 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
      |                    ~~~~~~~~~~^~~~~~~~~~~
a.cc:34:24: note: in definition of macro 'IN'
   34 | #define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
      |                        ^
a.cc:76:65: note: in expansion of macro 'MIN'
   76 |                         if (V[i].first == x1 && IN(V[i].second, MIN(y1, y2), MAX(y1, y2))) {
      |                                                                 ^~~
a.cc:26:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 | #define MAX(a, b) ((a) > (b) ? (a) : (b))
      |                    ~~~~^~~~~
a.cc:34:45: note: in definition of macro 'IN'
   34 | #define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
      |                                             ^
a.cc:76:78: note: in expansion of macro 'MAX'
   76 |                         if (V[i].first == x1 && IN(V[i].second, MIN(y1, y2), MAX(y1, y2))) {
      |                                                                              ^~~
a.cc:26:30: error: operands to '?:' have different types 'double (*)(double) noexcept' and 'int'
   26 | #define MAX(a, b) ((a) > (b) ? (a) : (b))
      |                    ~~~~~~~~~~^~~~~~~~~~~
a.cc:34:45: note: in definition of macro 'IN'
   34 | #define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
      |                                             ^
a.cc:76:78: note: in expansion of macro 'MAX'
   76 |                         if (V[i].first == x1 && IN(V[i].second, MIN(y1, y2), MAX(y1, y2))) {
      |                                                                              ^~~
a.cc:77:47: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   77 |                                 return ABS(y2 - y1) * 100.0 - 20 + PI * 10;
      |                                            ~~ ^ ~~
      |                                            |    |
      |                                            int  double(double) noexcept
a.cc:28:19: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                   ^
a.cc:77:47: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   77 |                                 return ABS(y2 - y1) * 100.0 - 20 + PI * 10;
      |                                            ~~ ^ ~~
      |                                            |    |
      |                                            int  double(double) noexcept
a.cc:28:29: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                             ^
a.cc:77:47: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   77 |                                 return ABS(y2 - y1) * 100.0 - 20 + PI * 10;
      |                                            ~~ ^ ~~
      |                                            |    |
      |                                            int  double(double) noexcept
a.cc:28:38: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                                      ^
a.cc:80:31: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   80 |                 return ABS(y2 - y1) * 100.0;
      |                            ~~ ^ ~~
      |                            |    |
      |                            int  double(double) noexcept
a.cc:28:19: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                   ^
a.cc:80:31: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   80 |                 return ABS(y2 - y1) * 100.0;
      |                            ~~ ^ ~~
      |                            |    |
      |                            int  double(double) noexcept
a.cc:28:29: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                             ^
a.cc:80:31: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   80 |                 return ABS(y2 - y1) * 100.0;
      |                            ~~ ^ ~~
      |                            |    |
      |                            int  double(double) noexcept
a.cc:28:38: note: in definition of macro 'ABS'
   28 | #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
      |                                      ^
a.cc:83:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   83 |         if (y1 == y2) {
      |             ~~~^~~~~
a.cc:85:41: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   85 |                         if (V[i].second == y1 && IN(V[i].first, MIN(x1, x2), MAX(x1, x2))) {
a.cc:92:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   92 |         if (x1 > x2 && y1 > y2) {
      |                        ~~~^~~~
a.cc:94:21: error: no matching function for call to 'swap(double (&)(double) noexcept, int&)'
   94 |                 swap(y1, y2);
      |                 ~~~~^~~~~~~~
In file included from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note:   no known conversion for argument 1 from 'double(double) noexcept' to 'std::__exception_ptr::exception_ptr&'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |          ~~~~~~~~~~~~~~~^~~~~
In file included from a.cc:18:
/usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)'
 1204 |     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/14/sstream:1204:5: note:   template argument deduction/substitution failed:
a.cc:94:21: note:   mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'double(double) noexcept'
   94 |                 swap(y1, y2);
      |                 ~~~~^~~~~~~~
/usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)'
 1212 |     swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/14/sstream:1212:5: note:   template argument deduction/substitution failed:
a.cc:94:21: note:   mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   94 |                 swap(y1, y2);
      |                 ~~~~^~~~~~~~
/usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)'
 1219 |     swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/14/sstream:1219:5: note:   template argument deduction/substitution failed:
a.cc:94:21: note:   mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   94 |                 swap(y1, y2);
      |                 ~~~~^~~~~~~~
/usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)'
 1226 |     swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/14/sstream:1226:5: note:   template argument deduction/substitution failed:
a.cc:94:21: note:   mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   94 |                 swap(y1, y2);
      |                 ~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/list:62:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   template argument deduction/substitutio