Language: C++

#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

const int N = 200005;

int x1, y1, x2, y2;
int n, m;
int x[N], y[N];
pii a[N];
int LIS[N];

bool ok(int x, int y) {
	int mnY = min(y1, y2), mxY = max(y1, y2);
	return (x1 <= x && x <= x2 && mnY <= y && y <= mxY);
}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> x1 >> y1 >> x2 >> y2;
	if (x1 > x2) {
		swap(x1, x2);
		swap(y1, y2);
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (ok(x[i], y[i])) {
			a[m++] = mp(x[i], y[i]);
		}
	}
	sort(a, a + m);
	if (y1 > y2) {
		for (int i = 0; i < m; i++) {
			a[i].second *= -1;
		}
	}
	MMS(LIS, 0x3f);
	LIS[0] = -1e9;
	int mx = 0;
	for (int i = 0; i < m; i++) {
		int l = lower_bound(LIS, LIS + N, a[i].second) - LIS;
		mx = max(mx, l);
		LIS[l] = a[i].second;
	}
	double res = 0;
	if (mx < min(abs(x1 - x2), abs(y1 - y2)) + 1) {
		res = (abs(x1 - x2) + abs(y1 - y2)) * 100LL - mx * (20 - 5 * M_PI);
	} else {
		res = (abs(x1 - x2) + abs(y1 - y2)) * 100LL - (mx - 1) * (20 - 5 * M_PI) + (10 * M_PI - 20);
	}
	cout << fixed << setprecision(12) << res << endl;
	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/ext/hash_map:60,
                 from a.cc:2:
/usr/include/c++/14/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
   32 | #warning \
      |  ^~~~~~~
a.cc:52:9: error: 'int y1' redeclared as different kind of entity
   52 | 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 'bool ok(int, int)':
a.cc:59:22: error: no matching function for call to 'min(double (&)(double) noexcept, int&)'
   59 |         int mnY = min(y1, y2), mxY = max(y1, y2);
      |                   ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:59:22: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   59 |         int mnY = min(y1, y2), mxY = max(y1, y2);
      |                   ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:59:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   59 |         int mnY = min(y1, y2), mxY = max(y1, y2);
      |                   ~~~^~~~~~~~
a.cc:60:56: error: 'mxY' was not declared in this scope; did you mean 'mnY'?
   60 |         return (x1 <= x && x <= x2 && mnY <= y && y <= mxY);
      |                                                        ^~~
      |                                                        mnY
a.cc: In function 'int main()':
a.cc:71:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
   71 |         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,
                 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:71:22: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
   71 |         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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: 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:71:22: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
   71 |         cin >> x1 >> y1 >> x2 >> y2;
      |                      ^~
      |                      |
      |                      double (*)(double) noexcept
a.cc:71:22: error: cannot bind rvalue '(long long int)y1' to 'long long int&'
/usr/include/c++/14/istream:203:7: not