Admins, please add this to statement: "The coordinates are given with no more than 6 digits after a decimal point Tricky test case (even can't find its analogue). It contains such placement of draughts that you should precisely touch one or several other draughts by your move, and almost identical angles (+/- 1e-8 radians) will not give correct answer. When allow precisely touch got AC. P.S. Seems like one enemy draught you touch on the left side and other one - on the right side simultaneously. Edited by author 23.04.2023 18:44 New tricky tests have been added to the problem. All solutions have been rejudged. 152 authors (62% of all) lost their solved status for the problem. If you get WA 30 check this: 1) correct calculation of tangent line angle (asin(2R/D), NOT asin(R/D)) 2) check not only enemies circles to make your movement, but angles to your own circles too. You can destroy your circles and win by this angle (don't forget about this). These tests helped me: Test 1: 7.100 2.280 3.530 4.410 2.690 2.990 1.770 4.360 5.850 1.770 1.960 1.720 6.550 1.870 2.200 4.940 4.090 0.920 6.580 3.590 1.970 1.070 2.390 2.700 0.360 4.030 1.520 6.730 5.820 5.280 1.640 5.520 Answer: WHITE Test 2: 2.670 6.880 2.140 2.820 0.830 6.960 2.180 4.600 6.220 7.170 7.130 1.290 3.010 6.320 2.880 4.690 0.350 6.670 6.680 5.820 7.230 5.020 7.160 4.100 0.120 0.430 2.950 7.780 5.630 2.400 2.290 1.310 Answer: RED Edited by author 06.01.2023 21:45 Hint: ->, not <-> Rot13: Gur qenhtug bayl zbirf sbejneq jura chfurq, abg ovqverpgvbanyyl. 0.5 7.5 1.5 5.5 5.5 6.5 2.5 3.5 6.5 4.5 1.5 7.5 7.5 2.5 2.5 4.5 3.5 5.5 6.5 0.5 4.5 1.5 0.5 5.5 1.5 4.5 0.5 2.5 0.5 0.5 4.5 7.5 5.5 6.5 1.5 2.5 1.5 3.5 4.5 1.5 3.5 4.5 5.5 4.5 4.5 0.5 7.5 0.5 5.5 7.5 3.5 1.5 0.5 2.5 6.5 5.5 7.5 1.5 4.5 6.5 7.5 7.5 2.5 1.5 1.5 4.5 3.5 2.5 2.5 0.5 6.5 4.5 7.5 6.5 1.5 2.5 6.5 5.5 6.5 1.5 6.5 7.5 0.5 3.5 3.5 4.5 1.5 0.5 6.5 0.5 2.5 2.5 1.5 5.5 5.5 5.5 I have 4 AC solutions. Sets of answers to these tests are quite different =) Ау.. New tests will be added soon. Thank you. New tests were added. Problem was rejudged. Thank you! :) Could you give me some statistic? How many AC were, and how many AC are? There were 303 accepted solutions, and now there are 222 accepted solutions. 81 AC submits got WA. Unfortunately I have not exact statistics about problem authors who lost AC. First of all, precision of 1e-8 is ok to get AC (with double type and without trigonometry). Now about WA16 - that's the case when one of boundary rays is parallel to OX. When some angular segments crosses OX, I perform a split at 0/2PI point. In described case it was possible that I first delete a draught at point 0 and then add it. So, sorting should be not just angular, but also additions should precede deletions. This condition is automatic for regular cases, so I omitted it. But in described case special care should be taken. I think that it is DP-problem We consider 2^16 states from 0 to final=2^16-1 Before we make precalculation finding for each draught finite possible moves just as adjacent to some another draught and bisectors between adjacent rays Anywhere we must use eps≈0.0000001 as precision level. Having found all possible moves we can easy reduce state k to states with few value because one move make number of draughts smaller. Finding all possibilities we must consider adjacent rays to draughts with the same color as now active draught. Edited by author 27.06.2007 13:46 I think, it is impolite to explain solutions of good problems here in forum. Of course, greedy algo doesn't work here... This is an old problem and beginers need clear plan before starting to solve. I agree with svr. Things required to solve this problem are quite conceptual, so it's ok to tell them in the forum. Are there any tangential draughts in the input? And when a draught during its movement gets just tangential with another draught, is the latter considered to be killed? If both answers are yes: suppose there are two tangential draughts in the input (one left and one right), now I shoot the right one to the right, is the left one considered to be killed? I have got WA on #22. If one checker touches another initially, what should I do? I use minimax and alpha-beta cutting off. I use binary representation of the chessboard. Edited by moderator 28.10.2004 02:55 I believe you fill the white[] and red[] arrays in wrong order. When you're calculating white[p], you must have already had calculated red[p and go[i,j]], but it may happen that you hadn't. I get AC with this program. But it's wrong! Please give me some hints to solve this problem or Accepted program (not as my) :-)) {$A-,B-,D+,E+,F-,G-,I-,L+,N+,O-,P-,Q-,R-,S-,T-,V-,X-} Program t1163; Const Radius = 0.4; Change = Pi/180; N = 8; L = 8; Eps = 1E-5; Type Point = record X,Y : extended end; Vector = record rX,rY : extended end; IMas = array[1..N]of byte; Var R,W : array[1..N]of Point; Ru,Wu : IMas; i : integer; count : integer; Function GetW(A : Vector) : extended; Var tgW,W : extended; begin if abs(A.rX)=0 then begin if A.rY<0 then W:=270 else W:=90; end else if abs(A.rY)=0 then begin if A.rX<0 then W:=180 else W:=0; end else begin tgW:=Abs(A.rY/A.rX); W:=ArcTan(tgW); W:=W/Change; if (A.rX<0)and(A.rY>0) then W:=180-W; if (A.rX<0)and(A.rY<0) then W:=180+W; if (A.rX>0)and(A.rY<0) then W:=360-W; end; GetW:=W; end; Function GetWT(a,b,c : extended) : extended; Var cosw,sinw,tgw,w : extended; begin cosw:=(b*b+c*c-a*a)/(2*b*c); sinw:=sqrt(abs(1-cosw*cosw)); if abs(cosw)<Eps then w:=90 else begin tgw:=sinw/cosw; w:=ArcTan(tgw); w:=w/Change; end; GetWT:=w; end; Function Dist(A,B : Point) : extended; begin Dist:=sqrt(sqr(A.X-B.X)+sqr(A.Y-B.Y)); end; Function Touch(begP,tP : Point; wF : extended) : boolean; Var TVector : Vector; w,aw,d,dp : extended; begin TVector.rX:=begP.X-tP.X; TVector.rY:=begP.Y-tP.Y; w:=GetW(TVector); aw:=abs(w-wF); if aw>180 then aw:=360-aw; aw:=aw*Change; dp:=Dist(begP,tP); d:=sqrt(2*dp*dp*(1-cos(aw))); Touch:= d<=2*Radius; end; Function WinGR : boolean; forward; Function WinGW : boolean; forward; Function WinGW : boolean; var i,j : integer; u,v,vv : integer; wh1,re1 : integer; A : Vector; w1,dw,d : extended; wFLICK : extended; Tr,Tw : IMas; ok : byte; pp : array[1..2*n*n]of IMas; begin inc(count); // SEE AT THIS // IF COUNT>10000 I // WRITE // 'RED' !! // if count>100000 then begin Writeln('RED'); Halt; end; vv:=0; for i:=1 to N do if Wu[i]=0 then for j:=N downto 1 do if Ru[j]=0 then begin A.rx:=W[i].X-R[j].X; A.ry:=W[i].Y-R[j].Y; w1:=GetW(A); d:=Dist(W[i],R[j]); dw:=GetWT(2*Radius,d,d); Wu[i]:=1; Tr:=Ru; Tw:=Wu; {go down} wFLICK:=w1-dw; if wFLICK<0 then wFLICK:=wFLICK+360; wh1:=0; re1:=0; for u:=1 to N do if Wu[u]=0 then if Touch(W[i],W[u],wFLICK) then begin Wu[u]:=1; inc(wh1); end; for u:=1 to N do if Ru[u]=0 then if Touch(W[i],R[u],wFLICK) then begin Ru[u]:=1; inc(re1); end; ok:=1; for u:=1 to vv do begin ok:=0; for v:=1 to 8 do if pp[u][v]<ru[v] then ok:=1; if ok=1 then break; end; if wh1<re1 then if ok=1 then begin inc(vv); for u:=1 to 8 do pp[vv][u]:=ru[u]; if not(WinGR) then begin WinGW:=true; Wu[i]:=0; exit; end; end; Ru:=Tr; Wu:=Tw; {go up} wFLICK:=w1+dw; if wFLICK>360 then wFLICK:=wFLICK-360; wh1:=0; re1:=0; for u:=1 to N do if Wu[u]=0 then if Touch(W[i],W[u],wFLICK) then begin Wu[u]:=1; inc(wh1); end; for u:=1 to N do if Ru[u]=0 then if Touch(W[i],R[u],wFLICK) then begin Ru[u]:=1; inc(re1); end; ok:=1; for u:=1 to vv do begin ok:=0; for v:=1 to 8 do if pp[u][v]<ru[v] then ok:=1; if ok=1 then break; end; if ok=1 then begin inc(vv); for u:=1 to 8 do pp[vv][u]:=ru[u]; if wh1<re1 then if not(WinGR) then begin WinGW:=true; Wu[i]:=0; exit; end; end; Ru:=Tr; Wu:=Tw; |
|