To mr.Marat Bakirov or mr. Pavel Atnanshev (+)
Maybe there's something I don't understand, but the answer for each
test case should be either HIT or MISSED, right?
When I submit this program:
Var i:Longint;
Begin
For i:=1 To 100000000 Do;
Halt;
Writeln('HIT');
End.
It runs is 0.43 sec with WA, and when I submit this one:
Var i:Longint;
Begin
For i:=1 To 100000000 Do;
Halt;
Writeln('MISSED');
End.
The result is the same. But if the answer for the first test case id
HIT, then the first program must run at least 0.86 sec, and if the
answer is MISSED, then the second. But run in the same time - how can
this possibly be???
P.S. Here's my real program:
{$N+}
Program Darts;
Var cx,cy,cz,nx,ny,nz,r,sx,sy,sz,vx,vy,vz:Extended;
a,b,c,d,i,j,k,dd,t,x,y,z:Extended;
Function Dis:Real;
Begin
Dis:=Sqrt((x-cx)*(x-cx)+(y-cy)*(y-cy)+(z-cz)*(z-cz));
End;
Begin
read(cx,cy,cz,nx,ny,nz,r,sx,sy,sz,vx,vy,vz);
a:=nx; b:=ny; c:=nz; d:=-(a*cx+b*cy+c*cz);
i:=-c*5; j:=a*vx+b*vy+c*vz; k:=a*sx+b*sy+c*sz+d;
If i<>0 Then Begin
dd:=j*j-4*i*k;
If d<0 Then Begin
Writeln('MISSED');
Halt;
End;
dd:=Sqrt(dd);
t:=(-j-dd)/2/i;
If t>=0 Then Begin
x:=sx+vx*t;
y:=sy+vy*t;
z:=sz+vz*t-5*t*t;
If Dis<r Then Begin
Writeln('HIT');
Halt;
End;
End;
t:=(-j+dd)/2/i;
If t>=0 Then Begin
x:=sx+vx*t;
y:=sy+vy*t;
z:=sz+vz*t-5*t*t;
If Dis<r Then Begin
Writeln('HIT');
Halt;
End;
End;
Writeln('MISSED');
End Else If j=0 Then While True Do Else Begin
t:=-k/j;
If t>=0 Then Begin
x:=sx+vx*t;
y:=sy+vy*t;
z:=sz+vz*t-5*t*t;
If Dis<r Then Begin
Writeln('HIT');
Halt;
End;
End;
Writeln('MISSED');
End;
End.
I gave wrong programs there. There should be no halt , but ...(+)
Of course I sent these programs:
Var i:Longint;
Begin
For i:=1 To 100000000 Do;
Writeln('HIT');
End.
and
Var i:Longint;
Begin
For i:=1 To 100000000 Do;
Writeln('MISSED');
End.
But the result is the same as I described,so please help me!