Language: C++

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=200005;

int N,M,x1,y1,x2,y2;
pair<int,int> P[MAXN];
int dp[MAXN];

int main()
{
	scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&N);
	for(int i=1;i<=N;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=max(y1,y2))
			P[++M]=make_pair(x,y);
	}
	if(x1>x2)
	{
		swap(x1,x2);
		swap(y1,y2);
	}
	if(y1>y2)
	{
		for(int i=1;i<=M;i++)
			P[i].second=y2+y1-P[i].second;
		swap(y1,y2);
	}
	
	sort(P+1,P+M+1);
	memset(dp,0x3F,sizeof dp);
	dp[0]=0;
	int lis=0;
	for(int i=1;i<=M;i++)
	{
		int j=upper_bound(dp,dp+i,i)-dp;
		dp[j]=min(dp[j],P[i].second);
		lis=max(lis,j);
	}
	double ans=0;
	ans=100*(x2-x1+y2-y1)-20.0*lis+5.0*lis*acos(-1);
	if(lis==min(y2-y1+1,x2-x1+1))
		ans+=5.0*acos(-1);
	printf("%.11f\n",ans);
	
	return 0;
}


Compiler output:
a.cc:8:12: error: 'int y1' redeclared as different kind of entity
    8 | int N,M,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/cstdio:41,
                 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:19:53: error: no matching function for call to 'min(double (&)(double) noexcept, int&)'
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=max(y1,y2))
      |                                                  ~~~^~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:2:
/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:19:53: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=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,
                 from a.cc:4:
/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:19:53: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=max(y1,y2))
      |                                                  ~~~^~~~~~~
a.cc:19:71: error: no matching function for call to 'max(double (&)(double) noexcept, int&)'
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=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:19:71: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=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:19:71: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   19 |                 if(min(x1,x2)<=x&&x<=max(x1,x2)&&min(y1,y2)<=y&&y<=max(y1,y2))
      |                                                                    ~~~^~~~~~~
a.cc:25:21: error: no matching function for call to 'swap(double (&)(double) noexcept, int&)'
   25 |                 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:
/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/substitution failed:
a.cc:25:21: note:   deduced conflicting types for parameter '_Tp' ('double(double) noexcept' and 'int')
   25 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  250 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/14/bits/move.h:250:5: note:   template argument deduction/substitution failed:
a.cc:25:21: note:   mismatched types '_Tp [_Nm]' and 'double(double) noexcept'
   25 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
 1089 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note:   template argument deduction/substitution failed:
a.cc:25:21: note:   mismatched types 'std::pair<_T1, _T2>' and 'double(double) noexcept'
   25 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note:   template argument deduction/substitution failed:
a.cc:25:21: note:   mismatched types 'std::pair<_T1, _T2>' and 'double(double) noexcept'
   25 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
a.cc:27:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |         if(y1>y2)
      |            ~~^~~
a.cc:30:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                         P[i].second=y2+y1-P[i].second;
      |                                     ~~^~~
a.cc:30:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                         P[i].second=y2+y1-P[i].second;
      |                                     ~~~~~^~~~~~~~~~~~
a.cc:30:42: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   30 |                         P[i].second=y2+y1-P[i].second;
      |                                     ~~~~~^~~~~~~~~~~~
      |                                          |
      |                                          double (*)(double) noexcept
a.cc:31:21: error: no matching function for call to 'swap(double (&)(double) noexcept, int&)'
   31 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/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/substitution failed:
a.cc:31:21: note:   deduced conflicting types for parameter '_Tp' ('double(double) noexcept' and 'int')
   31 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  250 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/14/bits/move.h:250:5: note:   template argument deduction/substitution failed:
a.cc:31:21: note:   mismatched types '_Tp [_Nm]' and 'double(double) noexcept'
   31 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
 1089 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note:   template argument deduction/substitution failed:
a.cc:31:21: note:   mismatched types 'std::pair<_T1, _T2>' and 'double(double) noexcept'
   31 |                 swap(y1,y2);
      |                 ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidat