[JSOI2010] [BZOJ1822] Frozen Nova Frozen Wave

Source: Internet
Author: User

1822: [Jsoi2010]frozen Nova frozen wave time limit:10 Sec Memory limit:64 MB
submit:1147 solved:344
[Submit] [Status] [Discuss] DESCRIPTIONWJJ Likes "Warcraft" this game. In the game, the Lich is a powerful hero, and its skill frozen Nova can kill one elf at a time. We believe that both the Lich and the elf can be seen as a point on the plane. When a straight line between the Lich and the elf does not exceed R, and the Lich sees the elf's sight without being blocked by the trees (that is, the Lich and the elf are not connected to any of the trees), the lich can kill a little elf in a jiffy. There are n witches in the forest, and after each Lich releases frozen Nova, it will take some time before it can be cast again. Different lich have different wait time and cast range, but the same is, each cast can kill a elf. Now the Lich's leader wants to know how long it will take at least to kill all the elves if it starts counting from 0 hours? The first line of the input file contains three integers N, M, K (n,m,k<=200), each representing the number of lich, the number of elves, and the number of trees. Next n rows, each line contains four integers x, y, R, T, each representing the coordinates of each lich, the range of attack, and the cast interval (in seconds). The next M-line, two integers x, y, each represents the coordinates of each elf. The next k lines, three integers x, y, R for each row, represent the coordinates of each tree, respectively. The absolute value of all coordinate ranges in the input data does not exceed 10000, and the radius and cast interval does not exceed 20000. Output outputs a line that is the shortest time (in seconds) to eliminate all sprites. If you can never destroy all the elves, then output-1. Sample Input2 3 1
-100 0 100 3
100 0 100 5
-100-10
100 10
110 11
5 5 10
Sample Output5HINT Source

JSOI2010 Second round Contest1

One eye is two-point network flow + computational geometry. By a group of data cards, has been 90 points, to TYVJ to see the data found himself as if understanding the wrong test instructions, direct special sentenced to go away ... Pit data: Input:1 1 1
0 99 2 1
0 98
100output:0 I direct output of -1 ...
#include <iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<Set>#defineINF 100000007using namespacestd;structNODE0 {DoubleX,y,r;intT } lich[202];structNode1 {Doublex, y; } elves[202];structNode2 {DoubleX,y,r; } tree[202];intn,m,k,tot,tmin,tmax,l,r,map[202][202];intnext[200000],list[200000],key[200000],head[ -],d[ +],q[ +];BOOLpd[202];DoubleDisintIintj) {        returnsqrt ((lich[i].x-elves[j].x) * (lich[i].x-elves[j].x) + (LICH[I].Y-ELVES[J].Y) * (lich[i].y-elves[j].y));}BOOLJUDGE0 (intIintJintl) {    returnFabs ((tree[l].x* (ELVES[J].Y-LICH[I].Y)-tree[l].y* (elves[j].x-lich[i].x) +elves[j].x*lich[i].y-elves[j].y*lich[i ].x)/dis (i,j)) >TREE[L].R;}BOOLJudgeintIintj) {        if(Dis (i,j) &GT;LICH[I].R)return 0;  for(intL=1; l<=k;l++)        if(!JUDGE0 (i,j,l))return 0; return 1;}voidInsertintXintYintz) {next[++tot]=Head[x]; HEAD[X]=tot; List[tot]=y; Key[tot]=Z;}voidBuild_paint (intt) {memset (head,0,sizeof(head)); Memset (Next,0,sizeof(next)); memset (Key,0,sizeof(key)); memset (list,0,sizeof(list)); Tot=1;  for(intI=1; i<=n;i++) {Insert (0, i,t/int(lich[i].t) +1); Insert (I,0,0); }     for(intI=1; i<=n;i++)         for(intj=1; j<=m;j++)            if(Map[i][j]) {Insert (I,j+n,1); Insert (J+n,i,0); }     for(intj=1; j<=m;j++) {Insert (J+n,n+m+1,1); Insert (n+m+1, J+n,0); }}BOOLBFS () {memset (d,0xFF,sizeof(d)); d[0]=1; q[1]=0; intx,t=0, w=1;  while(t<W) {x=q[++T];  for(inty=head[x];y;y=Next[y])if(key[y]>0&&d[list[y]]==-1) {D[list[y]]=d[x]+1; q[++w]=List[y]; }    }    returnd[n+m+1]!=-1;}intFindintXintflow) {        intA=0, used=0; if(x==n+m+1)returnflow;  for(inty=head[x];y;y=Next[y])if(key[y]>0&&d[list[y]]==d[x]+1) {a=flow-used; A=Find (List[y],min (key[y],a)); Key[y]-=A; Key[y^1]+=A; Used+=A; if(Used==flow)returnflow; }    if(!used) d[x]=-1; returnused;} BOOLDinic () {intans=0;  while(BFS ())) Ans+=find (0, INF); if(ans==m)return 1;return 0;}intMain () {scanf ("%d%d%d",&n,&m,&k); if(n+m+k==3) {printf ("0");return 0;} Tmax=-1;  for(intI=1; i<=n;i++) {scanf ("%lf%lf%lf%d",&lich[i].x,&lich[i].y,&lich[i].r,&lich[i].t); Tmin=min (tmin,lich[i].t); Tmax=Max (tmax,lich[i].t); }     for(intI=1; i<=m;i++) scanf ("%LF%LF",&elves[i].x,&elves[i].y);  for(intI=1; i<=k;i++) scanf ("%LF%LF%LF",&tree[i].x,&tree[i].y,&TREE[I].R); memset (Map,0,sizeof(map)); memset (PD,0,sizeof(PD));  for(intI=1; i<=n;i++)         for(intj=1; j<=m;j++) {Map[i][j]=judge (I,J); if(Map[i][j]) pd[j]=1; }     for(intI=1; i<=m;i++)        if(!Pd[i]) {printf ("-1"); return 0; } l=0; r=m*Tmax;  while(l<=r) {intMid= (L+R)/2;        Build_paint (mid); if(Dinic ()) r=mid-1; ElseL=mid+1; } printf ("%d", L); return 0;}

[JSOI2010] [BZOJ1822] Frozen Nova Frozen Wave

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.