surface
50pts
First of all, of course, two points,
Then for a point, the area it can reach is an arc.
Now it's asking if there is a regular polygon endpoint that can be covered by these arcs.
Suppose there is a workable scheme now, if the regular polygon does not have an endpoint coincident with an endpoint of an arc,
So I can shake this regular polygon until one of its endpoints coincides with an endpoint of an arc,
I want to say that, if there is a viable solution, there must be a viable solution that makes the regular polygon have an endpoint coincident with an endpoint of an arc.
Since the number of endpoints for arcs has \ (O (n) \), this enumeration coincides with that endpoint, which can then be used to determine the other endpoints of the regular polygon.
Then you can build a two-point chart and ask if there is a perfect match.
Complexity is \ (O (N^4*LOGN) \) , can be over 50 points.
100pts
Pit to fill.
Code
#include <bits/stdc++.h> #define LL long Long#define db double#define fo (i,x,y) for (int i=x;i<=y;i++) #define FD ( i,x,y) for (int i=x;i>=y;i--) using namespace Std;const int Maxn=407,maxm=maxn*maxn;const db Pi=acos ( -1); int n,m;db step;struct p{int x, y;} A[maxn];void Init () {scanf ("%d%d", &n,&m); Fo (i,1,n) scanf ("%d%d", &a[i].x,&a[i].y); step=2*pi/n;} int n;db q[maxn*2],l[maxn],r[maxn];void newquery (db x) {while (x>=-pi+step) X-=step; while (X<-PI) X+=step; Q[++n]=x;} int fi[maxn],ne[maxm],la[maxm],va[maxm],tot,t;void Add (int a,int b,int c) {tot++; Ne[tot]=fi[a]; La[tot]=b; Va[tot]=c; Fi[a]=tot;} void Add (int a,int b,int c) {Add (a,b,c); Add (b,a,0);} int bz[maxn],id;int SAP (int v,int flow) {bz[v]=id; if (v==t) return flow; for (int k=fi[v];k;k=ne[k]) if (Bz[la[k]]<id && va[k]) {int I=sap (la[k],min (Va[k],flow)); if (i) {va[k]-=i; Va[k^1]+=i; return i; }} return 0;} BOOL Check (db ang) {db Y=ang; Tot=1; memset (fi,0,sizeof fi); Fo (i,1,n) {fo (j,1,n) {if (L[j]>r[j] && (l[j]<=y && y<=r[j]+pi*2 | | L[j]-pi*2<=y && y<=r[j]) | | L[J]<=R[J] && l[j]<=y && y<=r[j]) {ADD (1+j,1+n+i,1); }} Y+=step; } fo (i,1,n) Add (1,1+i,1); T=2+n+n; Fo (i,1,n) Add (1+n+i,t,1); int res=0; while (1) {id++; int Temp=sap (1,0X7FFFFFFF); if (!temp) break; Res+=temp; } return res>=n;} BOOL Judge (db Rad) {n=0; Fo (i,1,n) {db dist=sqrt (A[I].X*A[I].X+A[I].Y*A[I].Y); if (Rad+m<dist | | Dist<m-rad | | A[i].x==0 && a[i].y==0 && rad<m) return false; if (rad<m+dist) {db alpha=atan2 (a[i].y,a[i].x), Beta=acos ((M*m+dist*dist-rad*rad)/(2.0*m*dist)); L[i]=alpha-beta; R[i]=alpha+betA if (L[I]<-PI) L[i]+=2*pi; if (R[I]>=PI) R[i]-=2*pi; }else{L[i]=-pi; R[i]=pi; } newquery (L[i]); NewQuery (R[i]); } sort (q+1,q+n+1); FO (i,1,n) if ((I==1 | | q[i]-q[i-1]>1e-7) && check (Q[i])) return true; return false;} DB ans;void Solve () {db l=0,r=100; while (r-l>1e-9) {db mid= (L+R)/2; if (judge (mid)) R=mid; else L=mid; } ans=l;} void Print () {printf ("%.8lf\n", Ans);} int main () {freopen ("3.in", "R", stdin); Freopen ("3.out", "w", stdout); Init (); Solve (); Print (); return 0;}
"JSOI2018" Jedi counterattack