Language: C++

#include <bits/stdc++.h>
using namespace std;
const long double PI=3.14159265358979323846;

int main() {
	long double x1,y1,x2,y2;
	scanf("%Lf%Lf%Lf%Lf", &x1, &y1, &x2, &y2);
	if (x1>x2) {
		swap(x1,x2);
		swap(y1,y2);
	}
	int n;
	scanf("%d", &n);
	vector<pair<long double, long double> > v;
	bool FLAG=false;
	for (int i=0; i<n; i++) {
		long double x, y;
		scanf("%Lf%Lf", &x, &y);
		if (x1<=x && x<=x2) {
			if (y1==y2) FLAG=true;
			if (y1<=y2 && y1<=y && y<=y2) {
				FLAG|=x1==x2;
				v.push_back({x,y});
			}
			if (y2<=y1 && y2<=y && y<=y1) {
				FLAG|=x1==x2;
				v.push_back({x,y});
			}
		}
	}
	sort(v.begin(), v.end());
	vector<long double> vl;
	if (y1<=y2) {
		for (int i=0; i<v.size(); i++) {
		if (vl.empty()||v[i].second>vl.back()) vl.push_back(v[i].second);
		else {
			int loc=lower_bound(vl.begin(),vl.end(),v[i].second)-vl.begin();
			vl[loc]=v[i].second;
		}
	}
}
else {
	for (int i=0; i<v.size(); i++) {
		if (vl.empty()||-v[i].second>vl.back()) vl.push_back(-v[i].second);
		else {
			int loc=lower_bound(vl.begin(),vl.end(),-v[i].second)-vl.begin();
			vl[loc]=-v[i].second;
		}
	}
}
	//prlong doublef("%d\n", vl.size());
	long double ans=(long double)(abs(x2-x1)+abs(y2-y1))*(long double)100;
	if (!FLAG) ans+=(long double)(PI*5.0-20.0)*(long double)max(vl.size(),min(abs(x1-x2),abs(y1-y2))-1);
	if (FLAG||vl.size()==min(abs(x1-x2),abs(y1-y2))) ans+=(PI*10.0-20.0);
	printf("%.12Lf\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:68: error: no matching function for call to 'max(std::vector<long double>::size_type, long double)'
   53 |         if (!FLAG) ans+=(long double)(PI*5.0-20.0)*(long double)max(vl.size(),min(abs(x1-x2),abs(y1-y2))-1);
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:53:68: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'long double')
   53 |         if (!FLAG) ans+=(long double)(PI*5.0-20.0)*(long double)max(vl.size(),min(abs(x1-x2),abs(y1-y2))-1);
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
In file included from /usr/include/c++/14/algorithm:61:
/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:53:68: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   53 |         if (!FLAG) ans+=(long double)(PI*5.0-20.0)*(long double)max(vl.size(),min(abs(x1-x2),abs(y1-y2))-1);
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~