BZOJ1338: Pku1981 Circle and Points单位圆覆盖
发布日期:2021-05-06 03:50:31 浏览次数:37 分类:技术文章

本文共 833 字,大约阅读时间需要 2 分钟。

提供一个暴力的想法

极大肯定是两个点在圆周上
然后 O(n3) 暴力吧卡卡常数就过了

好吧。。。

其实有个 O(n2lgn) 的解法 主要思路就是对于每个点求包含这个点的最被包含点集
具体看爱神Blog

#include
#include
#include
#include
#include
using namespace std;constdouble r=1;const double pi=acos(-1);const double eps=1e-7;struct Circle{ double x,y; inline void get(){ scanf("%lf%lf",&x,&y);}}P[100001];#define abs(a) ((a)<0?(-(a)):(a))struct Pair{ double bg; int ed; inline friend bool operator <(Pair a,Pair b){ return a.bg
2.0)continue; double T=atan2(P[j].y-P[i].y,P[j].x-P[i].x); T=T<0?T+2*pi:T; double Pt=acos(D/2.0); Cache[++tot]=(Pair){T-Pt+2*pi,false}; Cache[++tot]=(Pair){T+Pt+2*pi,true}; } int sum=0; sort(Cache+1,Cache+1+tot); for(int i=1;i<=tot;i++) if(Cache[i].ed)sum--; else ans=max(ans,++sum); } printf("%d\n",ans+1); } return 0;}
上一篇:懵逼ZJOI2016Round2滚粗记
下一篇:BZOJ3345: Pku2914 Minimum Cut

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年03月12日 14时48分11秒