Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)


const double PI=acos(-1.0);
const int N=2e5+50,oo=0x3f3f3f3f;

int a[N],n,q,x1,y1,x2,y2;
struct P { int x,y; } p[N],z[N];
bool operator<(P a,P b){return a.x<b.x;}
double ans;
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&n);
	rep(i,1,n)scanf("%d%d",&p[i].x,&p[i].y);
	if(x1==x2||y1==y2){
		if(x1==x2){
			int l=min(y1,y2),r=max(y1,y2);
			rep(i,1,n)if(p[i].x==x1){
				if(l<p[i].y&&p[i].y<r)ans+=-20+10*PI;
			}
			ans+=100*(r-l);
		}else{
			int l=min(x1,x2),r=max(x1,x2);
			rep(i,1,n)if(p[i].y==y1){
				if(l<p[i].x&&p[i].x<r){
					ans+=-20+10*PI;
				}
			}
			ans+=100*(r-l);
		}
		printf("%.15lf\n",ans);
		return 0; 
	}
	if(x1>x2)swap(x1,x2),swap(y1,y2);
	Pr("%d,%d,%d,%d\n",x1,y1,x2,y2);
	int yr=max(y1,y2),yl=min(y1,y2);
	rep(i,1,n){
		if(x1<=p[i].x&&p[i].x<=x2&&yl<=p[i].y&&p[i].y<=yr){
			z[++q]=p[i];
		}
	}
	sort(z+1,z+q+1);
	if(y1>y2)reverse(z+1,z+q+1);
	rep(i,1,q)Pr("(%d,%d)\n",z[i].x,z[i].y);
	memset(a,0x3f,sizeof(a));
	rep(i,1,q){
		*lower_bound(a+1,a+q+1,z[i].y)=z[i].y;
	}
	rep(i,1,q+1)if(a[i]==oo){

		ans+=-20*(i-1)+PI*5*(i-1);
		break;
	}
	ans+=100*(abs(x1-x2)+abs(y1-y2));
	printf("%.15lf\n",ans);
	return 0; 
}



Compiler output:
a.cc:17:17: error: 'int y1' redeclared as different kind of entity
   17 | int a[N],n,q,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(int, char**)':
a.cc:28:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |         if(x1==x2||y1==y2){
      |                    ~~^~~~
a.cc:30:34: error: no matching function for call to 'min(double (&)(double) noexcept, int&)'
   30 |                         int l=min(y1,y2),r=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:30:34: note:   deduced conflicting types for parameter 'const _Tp' ('double(double) noexcept' and 'int')
   30 |                         int l=min(y1,y2),r=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:30:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double) noexcept'
   30 |                         int l=min(y1,y2),r=max(y1,y2);
      |                               ~~~^~~~~~~
a.cc:32:53: error: 'r' was not declared in this scope
   32 |                                 if(l<p[i].y&&p[i].y<r)ans+=-20+10*PI;
      |                                                     ^
a.cc:34:35: error: 'r' was not declared in this scope
   34 |                         ans+=100*(r-l);
      |                                   ^
a.cc:37:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |                         rep(i,1,n)if(p[i].y==y1){
      |                                      ~~~~~~^~~~
a.cc:47:34: error: no matching function for call to 'swap(double (&)(double) noexcept, int&)'
   47 |         if(x1>x2)swap(x1,x2),swap(y1,y2);
      |                              ~~~~^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77:
/usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match)
  430 |   inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
      |               ^~~~
/usr/include/c++/14/any:430:15: note:   conversion of argument 2 would be ill-formed:
a.cc:47:38: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any'
   47 |         if(x1>x2)swap(x1,x2),swap(y1,y2);
      |                                      ^~
/usr/include/c++/14/any:191:7: note:   after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int&; _VTp = int; _Mgr = _Manager_internal<int>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]'
  191 |       any(_Tp&& __value)
      |       ^~~
In file included from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/stdexcept:38,
                 from /usr/include/c++/14/system_error:43,
                 from /usr/include/c++/14/bits/ios_base.h:46,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/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 /usr/include/c++/14/future:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)'
  328 |   swap(thread& __x, thread& __y) noexcept
      |   ^~~~
/usr/include/c++/14/bits/std_thread.h:328:16: note:   no known conversion for argument 1 from 'double(double) noexcept' to 'std::thread&'
  328 |   swap(thread& __x, thread& __y) noexcept
      |        ~~~~~~~~^~~
In file included 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/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:47:34: note:   mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),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:47:34: note:   mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),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:47:34: note:   mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),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:47:34: note:   mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),swap(y1,y2);
      |                              ~~~~^~~~~~~
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)'
  896 |     swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/regex.h:896:5: note:   template argument deduction/substitution failed:
a.cc:47:34: note:   mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),swap(y1,y2);
      |                              ~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)'
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/regex.h:2230:5: note:   template argument deduction/substitution failed:
a.cc:47:34: note:   mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'double(double) noexcept'
   47 |         if(x1>x2)swap(x1,x2),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/inc