Use the Triangle area to calculate points to the distance of the line and so on ... In fact, the situation of tangency is feasible ... The rest is just like a SDOI2015.
#include <cstdio> #include <cmath> #include <algorithm> #include <cstring> #include <queue >using namespace std; #define N 201#define EPS 0.000001#define INF 2147483647struct point{int x, y;} Jl[n];typedef point vector;typedef double db; Vector operator-(point A,point B) {return (Vector) {a.x-b.x,a.y-b.y};} int Cross (Vector A,vector b) {return a.x*b.y-a.y*b.x;} int sqr (int x) {return x*x;} DB Dis (point A,point b) {return sqrt ((db) (SQR (a.x-b.x) +SQR (A.Y-B.Y)));} struct wy{point p; int r,t;} Wy[n];struct shu{point p; int r;} Shu[n];int Abs (int x) {return x<0? ( -X): ×;} BOOL Can[n][n];int n,m,k;bool can_attack (WY a,point b) {if (db) A.r-dis (a.p,b) <eps) return 0;for (int i=1;i<=k;++i) if (db) Abs (Cross (a.p-b,shu[i].p-b))/dis (a.p,b)-(db) shu[i].r<-eps) return 0;return 1;} BOOL must_be_attacked (int x) {for (int i=1;i<=n;++i) if (Can[i][x]) return 1;return 0;} Queue<int>q;int nn,t,s;int v[2*n* (n+1)],en,first[n*2+3],next[2*n* (n+1)],cap[2*n* (N+1)];int d[N*2+3],cur[N*2 +3];voID addedge (int u,int v,int Cap) {v[en]=v; cap[en]=cap; next[en]=first[u]; first[u]=en++;v[en]=u; cap[en]=0; next[en]= FIRST[V]; first[v]=en++;} BOOL BFs () {memset (d,-1,sizeof (int) * (nn+1));d [s]=0; Q.push (S); while (!q.empty ()) {int U=q.front (); Q.pop (); for (int i=first[u];i!=-1;i=next[i]) if (cap[i]&&d[v[i]]==-1) {d[v[i]]=d[u]+1; Q.push (V[i]); }}return d[t]!=-1;} int dfs (int u,int a) {if (u==t| | (!a)) return a;int flow=0,f;for (int i=first[u];i!=-1;i=next[i]) if (d[v[i]]==d[u]+1&& (F=dfs (v[i],min)))) {cap[i]-=f; Cap[i^1]+=f; Flow+=f; A-=f; if (!a) break; }if (! flow) D[u]=-1;return flow;} int Maxflow () {int flow=0,tmp;while (BFS ()) {memcpy (cur,first,sizeof (int) * (nn+1)); while (Tmp=dfs (S,inf)) flow+=tmp; }return Flow;} BOOL Check (int Lim) {memset (first,-1,sizeof (int) * (nn+1)), en=0;for (int i=1;i<=n;++i) Addedge (S,1+i, (! Lim)? 1: (lim/wy[i].t+1)), for (int i=1;i<=m;++i) Addedge (1+n+i,t,1), for (int i=1;i<=n;++i) for (int j=1;j<=m;++j) if (Can[i][j]) Addedge (1+i,1+n+j,inf); return Maxflow () ==m?1:0;} int main () {scanf ("%d%d%d", &n,&m,&k), for (int i=1;i<=n;++i) scanf ("%d%d%d%d", &wy[i].p.x,&wy[ I].P.Y,&WY[I].R,&WY[I].T), for (int i=1;i<=m;++i) scanf ("%d%d", &jl[i].x,&jl[i].y), and for (int i=1;i <=k;++i) scanf ("%d%d%d", &SHU[I].P.X,&SHU[I].P.Y,&SHU[I].R); for (int. i=1;i<=n;++i) for (int j=1;j <=M;++J) Can[i][j]=can_attack (Wy[i],jl[j]); for (int j=1;j<=m;++j) if (! Must_be_attacked (j)) {puts ("-1"); return 0;} t=nn=n+m+2; S=1;int L=0,r=4000000;while (r>l) {int mid= (l+r>>1); if (check (mid)) R=mid; else l=mid+1; }printf ("%d\n", l); return 0;}
Compute geometry, dichotomy answer, max flow bzoj1822 [Jsoi2010]frozen Nova freeze Wave