Language: C++

#include <bits/stdc++.h>

template <class T>
void scan(T &x) {
	register char ch; x = 0;
	for (ch = getchar(); ~ch && (ch < '0' || ch > '9'); ch = getchar());
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}

const double pi = acos(-1.), cir = 2 * pi * 10;

int x1, y1, x2, y2;
int n;

struct vec {
	int x, y;
	
	bool operator < (const vec &rhs) const {
		return x < rhs.x;
	}
	
	void scan() {
		::scan(x); ::scan(y);
	}
} p[200005];

int sorted[200005];

int hsh(int x) {
	return std::lower_bound(sorted + 1, sorted + n + 1, x) - sorted;
}

int xl, xr, yl, yr;

namespace BIT {
	int c[200005];
	
#define lowbit(x) ((x) & -(x))
	
	void modify(int a, int x) {
		for (int i = a; i <= n; i += lowbit(i))
			c[i] = std::max(c[i], x);
	}
	
	int query(int a) {
		int res = 0;
		for (int i = a; i > 0; i -= lowbit(i))
			res = std::max(res, c[i]);
		return res;
	}
}

int main() {
	scan(x1); scan(y1); scan(x2); scan(y2); scan(n);
	
	xl = std::min(x1, x2); xr = std::max(x1, x2);
	yl = std::min(y1, y2); yr = std::max(y1, y2);
	
	for (int i = 1; i <= n; ++i) {
		p[i].scan();
		if (p[i].x < xl || p[i].x > xr || p[i].y < yl || p[i].y > yr) {
			--i; --n;
		}
		else {
			sorted[i] = p[i].y;
		}
	}
	
	std::sort(p + 1, p + n + 1);
	std::sort(sorted + 1, sorted + n + 1);
	
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		int t = hsh(p[i].y), tmp = BIT::query(t - 1);
		cnt = std::max(cnt, tmp + 1);
		BIT::modify(t, tmp + 1);
	}
	
	double ans = ((xr - xl) + (yr - yl)) * 100.;
	
//	std::cerr << cnt << std::endl;
	
	if (xl == xr || yl == yr) {
		ans = ans - cnt * 20 + cnt * cir * 0.5;
	}
	else {
		ans = ans - cnt * 20 + cnt * cir * 0.25;
	}
	
	printf("%.13f\n", ans);
	
	return 0;
}

Compiler output:
a.cc: In function 'void scan(T&)':
a.cc:5:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register char ch; x = 0;
      |                       ^~
a.cc: At global scope:
a.cc:12:9: error: 'int y1' redeclared as different kind of entity
   12 | 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 main()':
a.cc:57:22: error: no matching function for call to 'min(double (&)(double) noexcept, int&)'
   57 |         yl = std::min(y1, y2); yr = std::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:57:22: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   57 |         yl = std::min(y1, y2); yr = std::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:57:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   57 |         yl = std::min(y1, y2); yr = std::max(y1, y2);
      |              ~~~~~~~~^~~~~~~~
a.cc:57:45: error: no matching function for call to 'max(double (&)(double) noexcept, int&)'
   57 |         yl = std::min(y1, y2); yr = std::max(y1, y2);
      |                                     ~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:57:45: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   57 |         yl = std::min(y1, y2); yr = std::max(y1, y2);
      |                                     ~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:57:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   57 |         yl = std::min(y1, y2); yr = std::max(y1, y2);
      |                                     ~~~~~~~~^~~~~~~~
a.cc: In instantiation of 'void scan(T&) [with T = int]':
a.cc:23:9:   required from here
   23 |                 ::scan(x); ::scan(y);
      |                 ~~~~~~^~~
a.cc:5:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register char ch; x = 0;
      |                       ^~
a.cc: In instantiation of 'void scan(T&) [with T = double(double) noexcept]':
a.cc:54:16:   required from here
   54 |         scan(x1); scan(y1); scan(x2); scan(y2); scan(n);
      |                   ~~~~^~~~
a.cc:5:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         register char ch; x = 0;
      |                       ^~
a.cc:5:29: error: assignment of read-only reference 'x'
    5 |         register char ch; x = 0;
      |                           ~~^~~
a.cc:7:62: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
    7 |         for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
      |                                                            ~~^~~~