From b4037033ddeaf3016b9e38973c2b69967c6c4b2d Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Wed, 21 Aug 2024 21:05:04 +0800 Subject: [PATCH] update --- 20240821/P1158/P1158.cpp | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/20240821/P1158/P1158.cpp b/20240821/P1158/P1158.cpp index 6a3d1fd..1e48645 100644 --- a/20240821/P1158/P1158.cpp +++ b/20240821/P1158/P1158.cpp @@ -1,4 +1,7 @@ +#include #include +#include +#include #include #include #include @@ -7,17 +10,41 @@ using namespace std; const int MAX_N = 1e5+5; struct Dir{ - Dir(int x,int y):x(x),y(y){} - int x,y; + int x,y,dis1,dis2; friend ostream& operator<<(ostream &os,Dir d){ os<<"Dir { x="<bool{ + return a.dis1=1;i--){ + if(dirs[i+1].dis2>r2)r2=dirs[i+1].dis2; //将距离拦截器一更远的那个纳入拦截器2的射程 + ans=min(ans,dirs[i].dis1+r2); + } + + cout<