Surface
Test instructions: give you a matrix, and then there are a lot of circles, these circles may intersect, one or a few lead to this rectangle is split open, that is, from the bottom edge to the upper edge, the lines are blocked by these circles, each pile of circles as a hindrance, ask a total of several obstacles
The problem: It looks so hard to do ah!~!, how do I know a bunch of circles will be the matrix of a cross-section of the local area are accounted for
Eh then suddenly found that the intersection of the 2 circle, is not able to connect the edge,
Then from the sub-chart for each unicom, is not the leftmost circle on a bit more than the left side of the rectangle, while the right is also separated!
So the map (the actual figure does not have to be built out), DFS a bit on the line
Pay attention to the problem of precision, all of the size-related final with EPS
1#include <bits/stdc++.h>2 using namespacestd;3 #defineN 10054 #defineEPS 1e-65 DoubleW,L,X[N],Y[N],R[N],LL,RR;6 intcnt,t,n,vis[n],ok=1;7 DoubleSqrDoublex) {returnx*x;}8 intCheckintAintb)9 {Ten return((Sqr (X[a]-x[b]) +SQR (Y[a]-y[b]) <SQR (r[a]+r[b]+EPS)); One } A voidDfsintu) - { - if(Vis[u])return ; thevis[u]=1; - if(x[u]+r[u]>=w) ok=0; - for(intv=0; v<n;v++) - { + if(V==u)Continue; - if(!vis[v] &&Check (u,v)) Dfs (v); + } A return ; at } - intMain () - { -scanf"%d",&T); - while(t--) - { inscanf"%D%LF%LF",&n,&w,&l); -Cnt=0; tomemset (Vis,0,sizeof(Vis)); + for(intI=1; i<=n;i++) scanf ("%LF%LF%LF",&x[i],&y[i],&r[i]); - for(intI=1; i<=n;i++) the if(x[i]-r[i]<=EPS) * { $ok=1;Panax Notoginseng if(!Vis[i]) DFS (i); - if(ok==0) cnt++; the + } Aprintf"%d\n", CNT); the } +}
gym-101915j The Volcano eruption computational geometry