Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265358979323846
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

struct point{
    int x,y;
}p[200050];
int top;
int t[1000000];
int n;
int x[200050];
point sta,endd;

void write(int index,int l,int r,int aim,int num){
    if (l==r){
        t[index]=max(t[index],num);
        return;
    }
    int mid=(l+r)>>1;
    if (mid>=aim)       write(index<<1,l,mid,aim,num);
    else                write(index<<1|1,mid+1,r,aim,num);
    t[index]=max(t[index<<1],t[index<<1|1]);
}

int read(int index,int l,int r,int aiml,int aimr){
    if (aiml<=l&&r<=aimr){
        return t[index];
    }
    int mid=(l+r)>>1,ans=0;
    if (mid>=aiml)  ans=max(ans,read(index<<1,l,mid,aiml,aimr));
    if (mid<aimr)   ans=max(ans,read(index<<1|1,mid+1,r,aiml,aimr));
    return ans;
}

bool mmp1(point a,point b){
	return a.y<b.y||(a.y==b.y&&a.x<b.x);
}

bool mmp2(point a,point b){
	return a.y>b.y||(a.y==b.y&&a.x<b.x);
}

int main(){
    memset(t,0,sizeof(t));
    sta.x=read();sta.y=read();
    endd.x=read();endd.y=read();
    if (endd.x<sta.x)   swap(sta,endd);
    n=read();
    top=0;
    if (sta.y<endd.y){
        for (int i=1,tmpx,tmpy;i<=n;i++){
            tmpx=read();tmpy=read();
            if (tmpx>=sta.x&&tmpx<=endd.x
                &&tmpy>=sta.y&&tmpy<=endd.y)
                top++;
            else    continue;
            p[top].x=tmpx;p[top].y=tmpy;
        }
        sort(p+1,p+top+1,mmp1);
    }
    else{
        for (int i=1,tmpx,tmpy;i<=n;i++){
            tmpx=read();tmpy=read();
            if (tmpx>=sta.x&&tmpx<=endd.x
                &&tmpy<=sta.y&&tmpy>=endd.y)
                top++;
            else    continue;
            p[top].x=tmpx;p[top].y=tmpy;
        }
        sort(p+1,p+top+1,mmp2);
    }
    n=top;
    //加上同行或同列的特判
    if (sta.x==endd.x||sta.y==endd.y){
        double anns=0.0;
        if(n>0)     anns=anns+pi*10.0-20.0;
        anns=anns+fabs(sta.y-endd.y)*100.0+fabs(sta.x-endd.x)*100.0;
        printf("%.15lf\n",anns);
        return 0;
    }
    else if (min(abs(sta.x-endd.x),abs(sta.y-endd.y)+1==n){
        double anns=0.0;
        anns=anns+3*pi*10.0-40.0;
        anns=anns+fabs(sta.y-endd.y)*100.0+fabs(sta.x-endd.x)*100.0;
        printf("%.15lf\n",anns);
        return 0;
    }
    n=top;
    for (int i=1;i<=n;i++){
            x[i]=p[i].x;
    }
    sort(x+1,x+n+1);
    for (int i=1;i<=n;i++)  p[i].x=lower_bound(x+1,x+n+1,p[i].x)-x;
    for (int i=1;i<=n;i++){
        int num=read(1,1,n,1,p[i].x);
        write(1,1,n,p[i].x,num+1);
    }
    long long diff1=abs(sta.x-endd.x),diff2=abs(endd.y-sta.y);
    double ans=(pi*5-2*10)*t[1]+diff1*100.0+diff2*100.0;
    printf("%.15lf\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:17: error: no matching function for call to 'min(int, bool)'
   87 |     else if (min(abs(sta.x-endd.x),abs(sta.y-endd.y)+1==n){
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:87:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'bool')
   87 |     else if (min(abs(sta.x-endd.x),abs(sta.y-endd.y)+1==n){
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:87:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   87 |     else if (min(abs(sta.x-endd.x),abs(sta.y-endd.y)+1==n){
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:94:10: error: expected ')' before ';' token
   94 |     n=top;
      |          ^
      |          )
a.cc:87:13: note: to match this '('
   87 |     else if (min(abs(sta.x-endd.x),abs(sta.y-endd.y)+1==n){
      |             ^