10708 - Cheetah
Moderator: Board moderators
10708 - Cheetah
Could someone got ac give some test case? btw, if the cheetah and the prey is in the same position, then C=P?
-
- New poster
- Posts: 28
- Joined: Tue Aug 03, 2004 8:11 pm
- Contact:
10708 -
In test dont have P == C
I get WA!! help-me .
my INput
16
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
0 0 1 1 45 1 1 10000
0 0 1 1 45 1 2 10
-1 1 1 -1 135 1 1 10
2 3 2 4 90 1 2 10
2 4 2 3 270 1 2 10
2 4 2 3 270 1 1 10
2 4 2 3 90 1 1 10
1 1 2 2 45 1 1 10
-5 -5 0 0 315 1 2 10
-5 -5 0 0 225 1 1 10
1 1 2 1 90 1 2 20
5 5 1 1 135 1 6 20
-1 -1 -3 -3 90 1 2 10
125 40 99 80 121 22 80 1
my output
45.00 4.24 3.00 3.00
sorry, buddy
sorry, buddy
45.00 1.41 2.00 2.00
315.00 1.41 0.00 0.00
90.00 1.00 2.00 5.00
270.00 1.00 2.00 2.00
sorry, buddy
270.00 0.50 2.00 3.50
sorry, buddy
345.00 4.08 2.89 -2.89
225.00 3.54 -2.50 -2.50
30.00 0.58 2.00 1.58
35.41 0.96 0.32 1.68
204.30 1.10 -3.00 -1.90
57.53 0.82 89.68 95.51
I get WA!! help-me .
my INput
16
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
0 0 1 1 45 1 1 10000
0 0 1 1 45 1 2 10
-1 1 1 -1 135 1 1 10
2 3 2 4 90 1 2 10
2 4 2 3 270 1 2 10
2 4 2 3 270 1 1 10
2 4 2 3 90 1 1 10
1 1 2 2 45 1 1 10
-5 -5 0 0 315 1 2 10
-5 -5 0 0 225 1 1 10
1 1 2 1 90 1 2 20
5 5 1 1 135 1 6 20
-1 -1 -3 -3 90 1 2 10
125 40 99 80 121 22 80 1
my output
45.00 4.24 3.00 3.00
sorry, buddy
sorry, buddy
45.00 1.41 2.00 2.00
315.00 1.41 0.00 0.00
90.00 1.00 2.00 5.00
270.00 1.00 2.00 2.00
sorry, buddy
270.00 0.50 2.00 3.50
sorry, buddy
345.00 4.08 2.89 -2.89
225.00 3.54 -2.50 -2.50
30.00 0.58 2.00 1.58
35.41 0.96 0.32 1.68
204.30 1.10 -3.00 -1.90
57.53 0.82 89.68 95.51
Hi Per, are you sure that the cheetah cannot catch the prey for the 6th case:
Btw, my AC code gives the following output:
?2 3 2 4 90 1 2 10

Btw, my AC code gives the following output:
P.S. Yes, the special judge accepts -0.00.45.00 4.24 3.00 3.00
sorry, buddy
sorry, buddy
45.00 1.41 2.00 2.00
315.00 1.41 -0.00 0.00
90.00 1.00 2.00 5.00
270.00 1.00 2.00 2.00
sorry, buddy
270.00 0.50 2.00 3.50
sorry, buddy
15.00 4.08 2.89 -2.89
45.00 3.54 -2.50 -2.50
30.00 0.58 2.00 1.58
215.41 0.96 0.32 1.68
204.30 1.10 -3.00 -1.90
122.47 0.82 89.68 95.51
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
-
- New poster
- Posts: 28
- Joined: Tue Aug 03, 2004 8:11 pm
- Contact:
10708
thanx but get wa again
my output to last input now is
45.00 4.24 3.00 3.00
sorry, buddy
sorry, buddy
45.00 1.41 2.00 2.00
315.00 1.41 0.00 0.00
90.00 1.00 2.00 5.00
270.00 1.00 2.00 2.00
sorry, buddy
270.00 0.50 2.00 3.50
sorry, buddy
15.00 4.08 2.89 -2.89
45.00 3.54 -2.50 -2.50
30.00 0.58 2.00 1.58
215.41 0.96 0.32 1.68
204.30 1.10 -3.00 -1.90
122.47 0.82 89.68 95.51
but i see what -1 1 1 -1 135 1 1 10 is no valid.
my new input
18
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
5 5 1 1 135 1 6 20
15 15 11 11 135 1 6 20
12 12 8 8 135 1 6 20
4 4 0 0 135 1 6 20
8 8 12 12 135 1 6 20
7 8 11 12 135 1 6 10
8 7 12 11 135 1 6 10
5 5 1 1 315 1 6 10
5 5 9 9 315 1 6 10
2 1 3 1 0 1 2 10
2 1 3 1 180 1 1 10
3 1 2 1 180 1 1 10
3 1 2 1 0 1 1 10
4 1 4 2 90 1 2 5
4 1 4 2 90 1 6 5
4 1 4 2 270 1 1 1
out put
45.00 4.24 3.00 3.00
sorry, buddy
215.41 0.96 0.32 1.68
215.41 0.96 10.32 11.68
215.41 0.96 7.32 8.68
215.41 0.96 -0.68 0.68
54.59 0.96 11.32 12.68
54.59 0.96 10.32 12.68
54.59 0.96 11.32 11.68
234.59 0.96 1.68 0.32
35.41 0.96 9.68 8.32
0.00 1.00 4.00 1.00
0.00 0.50 2.50 1.00
sorry, buddy
180.00 0.50 2.50 1.00
90.00 1.00 4.00 3.00
90.00 0.20 4.00 2.20
90.00 0.50 4.00 1.50
thanKss
my output to last input now is
45.00 4.24 3.00 3.00
sorry, buddy
sorry, buddy
45.00 1.41 2.00 2.00
315.00 1.41 0.00 0.00
90.00 1.00 2.00 5.00
270.00 1.00 2.00 2.00
sorry, buddy
270.00 0.50 2.00 3.50
sorry, buddy
15.00 4.08 2.89 -2.89
45.00 3.54 -2.50 -2.50
30.00 0.58 2.00 1.58
215.41 0.96 0.32 1.68
204.30 1.10 -3.00 -1.90
122.47 0.82 89.68 95.51
but i see what -1 1 1 -1 135 1 1 10 is no valid.
my new input
18
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
5 5 1 1 135 1 6 20
15 15 11 11 135 1 6 20
12 12 8 8 135 1 6 20
4 4 0 0 135 1 6 20
8 8 12 12 135 1 6 20
7 8 11 12 135 1 6 10
8 7 12 11 135 1 6 10
5 5 1 1 315 1 6 10
5 5 9 9 315 1 6 10
2 1 3 1 0 1 2 10
2 1 3 1 180 1 1 10
3 1 2 1 180 1 1 10
3 1 2 1 0 1 1 10
4 1 4 2 90 1 2 5
4 1 4 2 90 1 6 5
4 1 4 2 270 1 1 1
out put
45.00 4.24 3.00 3.00
sorry, buddy
215.41 0.96 0.32 1.68
215.41 0.96 10.32 11.68
215.41 0.96 7.32 8.68
215.41 0.96 -0.68 0.68
54.59 0.96 11.32 12.68
54.59 0.96 10.32 12.68
54.59 0.96 11.32 11.68
234.59 0.96 1.68 0.32
35.41 0.96 9.68 8.32
0.00 1.00 4.00 1.00
0.00 0.50 2.50 1.00
sorry, buddy
180.00 0.50 2.50 1.00
90.00 1.00 4.00 3.00
90.00 0.20 4.00 2.20
90.00 0.50 4.00 1.50
thanKss

-
- New poster
- Posts: 28
- Joined: Tue Aug 03, 2004 8:11 pm
- Contact:
10708 - Cheetah

if somebody will have an input with some special case will be coming well
I distrust that I am deceiving itself in I only calculate it of the angulos
31
0 10000 9999 0 360 400 500 10000
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
5 5 1 1 135 1 6 20
15 15 11 11 135 1 6 20
12 12 8 8 135 1 6 20
4 4 0 0 135 1 6 20
8 8 12 12 135 1 6 20
7 8 11 12 135 1 6 10
8 7 12 11 135 1 6 10
5 5 1 1 315 1 6 10
5 5 9 9 315 1 6 10
2 1 3 1 0 1 2 10
2 1 3 1 180 1 1 10
3 1 2 1 180 1 1 10
3 1 2 1 0 1 1 10
4 1 4 2 90 1 2 5
4 1 4 2 90 1 6 5
4 1 4 2 270 1 1 1
6 1 3 3 135 1 2 10
12 45 78 45 122 1 2 100
12 11 33 5 345 1 2 100
11 12 5 33 135 1 2 100
14 77 88 99 65 10 36 100
2 2 6 6 278 1 2 45
133 45 7 1 1 20 10
4 5 8 7 210 1 2 10
8 7 1 1 235 1 2 20
45 59 111 221 92 100000
88 88 77 77 344 1 2 1000
45 78 96 54 45 11 12 3
output
349.45 109.22 53688.44 0.01
45.00 4.24 3.00 3.00
sorry, buddy
215.41 0.96 0.32 1.68
215.41 0.96 10.32 11.68
215.41 0.96 7.32 8.68
215.41 0.96 -0.68 0.68
54.59 0.96 11.32 12.68
54.59 0.96 10.32 12.68
54.59 0.96 11.32 11.68
234.59 0.96 1.68 0.32
35.41 0.96 9.68 8.32
0.00 1.00 4.00 1.00
0.00 0.50 2.50 1.00
sorry, buddy
180.00 0.50 2.50 1.00
90.00 1.00 4.00 3.00
90.00 0.20 4.00 2.20
90.00 0.50 4.00 1.50
140.68 3.57 0.48 5.52
25.09 28.19 63.06 68.91
344.53 21.84 54.09 -0.65
120.00 20.49 -9.49 47.49
28.55 2.70 99.42 123.48
21.46 2.32 6.32 3.70
sorry, buddy
sorry, buddy
85.73 11.75 24.50 235.41
sorry, buddy
270.24 10.15 80.34 -447.97
236.58 0.49 32.98 13.15
[cpp]
X = cos(P) * U * T + Pp.x;
Y = sin(P) * U * T + Pp.y;
if((X - Cp.x))
{
C = (TOGRAD(atan((Y - Cp.y) / (X - Cp.x))));
if ((X - Cp.x) >= 0)
C = (C >= 0) ? (C) : (360 + C);
else
C += 180;
}
else if ((Y - Cp.y) > 0)
C = 90;
else
C = 270;
[/cpp]
I thanks any help.
my AC program gave this output for your input
try also these:
input:
output:
did u consider u==0 , v==0 , C & P are the same point?
nafi
Code: Select all
349.45 109.22 53688.44 0.00
45.00 4.24 3.00 3.00
sorry, buddy
215.41 0.96 0.32 1.68
215.41 0.96 10.32 11.68
215.41 0.96 7.32 8.68
215.41 0.96 -0.68 0.68
54.59 0.96 11.32 12.68
54.59 0.96 10.32 12.68
54.59 0.96 11.32 11.68
234.59 0.96 1.68 0.32
35.41 0.96 9.68 8.32
0.00 1.00 4.00 1.00
0.00 0.50 2.50 1.00
sorry, buddy
180.00 0.50 2.50 1.00
90.00 1.00 4.00 3.00
90.00 0.20 4.00 2.20
90.00 0.50 4.00 1.50
140.68 3.57 0.48 5.52
25.09 28.19 63.06 68.91
344.53 21.84 54.09 -0.65
120.00 20.49 -9.49 47.49
28.55 2.70 99.42 123.48
21.46 2.32 6.32 3.70
sorry, buddy
sorry, buddy
85.73 11.75 24.50 235.41
sorry, buddy
270.24 10.15 80.34 -447.97
236.58 0.49 32.98 13.15
input:
Code: Select all
30
-2 0 2 0 45 10 10 1000
-2 0 2 0 45 10 9 1000
-2 0 2 0 45 9 10 1000
-2 0 2 0 60 10 10 1000
-2 0 2 0 60 10 9 1000
-2 0 2 0 60 9 10 1000
-2 0 2 0 90 10 10 1000
-2 0 2 0 90 10 9 1000
-2 0 2 0 90 9 10 1000
-2 0 2 0 91 10 10 1000
-2 0 2 0 91 10 9 1000
-2 0 2 0 91 9 10 1000
-2 0 2 0 92 10 10 1000
-2 0 2 0 92 10 9 1000
-2 0 2 0 92 9 10 1000
-2 0 2 0 94 10 10 1000
-2 0 2 0 94 10 9 1000
-2 0 2 0 94 9 10 1000
-2 0 2 0 100 10 10 1000
-2 0 2 0 100 10 9 1000
-2 0 2 0 100 9 10 1000
-2 0 2 0 135 10 10 1000
-2 0 2 0 135 10 9 1000
-2 0 2 0 135 9 10 1000
-2 0 2 0 179 10 10 1000
-2 0 2 0 179 10 9 1000
-2 0 2 0 179 9 10 1000
-2 0 2 0 180 10 10 1000
-2 0 2 0 180 10 9 1000
-2 0 2 0 180 9 10 1000
Code: Select all
sorry, buddy
sorry, buddy
39.52 2.96 20.86 18.86
sorry, buddy
sorry, buddy
51.21 2.27 12.20 17.66
sorry, buddy
sorry, buddy
64.16 0.92 2.00 8.26
89.00 11.46 0.00 114.58
sorry, buddy
64.14 0.89 1.86 7.97
88.00 5.73 0.00 57.27
sorry, buddy
64.09 0.85 1.73 7.68
86.00 2.87 0.00 28.60
sorry, buddy
63.87 0.79 1.50 7.14
80.00 1.15 0.00 11.34
sorry, buddy
62.42 0.65 0.99 5.72
45.00 0.28 0.00 2.00
51.78 0.32 -0.24 2.24
39.52 0.28 0.19 1.81
1.00 0.20 0.00 0.03
1.11 0.21 -0.11 0.04
0.90 0.21 0.11 0.03
0.00 0.20 0.00 0.00
0.00 0.21 -0.11 0.00
0.00 0.21 0.11 0.00
nafi
-
- New poster
- Posts: 28
- Joined: Tue Aug 03, 2004 8:11 pm
- Contact:
thanxssss for 10708
Thankss
I just think about asin range.

I just think about asin range.
my ac code gives answer to this test:
and it is easy to see if you do some simple drawing
Code: Select all
45 78 96 54 45 11 12 3
Code: Select all
sorry, buddy

Some test cases posted by schindlersp are wrong.
Here are his/her correct test cases and its output from my AC program:
Output:
Hope it help! 
Here are his/her correct test cases and its output from my AC program:
Code: Select all
29
0 10000 9999 0 360 400 500 10000
0 0 6 0 135 1 1 10
0 0 6 0 135 1 1 3
5 5 1 1 135 1 6 20
15 15 11 11 135 1 6 20
12 12 8 8 135 1 6 20
4 4 0 0 135 1 6 20
8 8 12 12 135 1 6 20
7 8 11 12 135 1 6 10
8 7 12 11 135 1 6 10
5 5 1 1 315 1 6 10
5 5 9 9 315 1 6 10
2 1 3 1 0 1 2 10
2 1 3 1 180 1 1 10
3 1 2 1 180 1 1 10
3 1 2 1 0 1 1 10
4 1 4 2 90 1 2 5
4 1 4 2 90 1 6 5
4 1 4 2 270 1 1 1
6 1 3 3 135 1 2 10
12 45 78 45 122 1 2 100
12 11 33 5 345 1 2 100
11 12 5 33 135 1 2 100
14 77 88 99 65 10 36 100
2 2 6 6 278 1 2 45
4 5 8 7 210 1 2 10
8 7 1 1 235 1 2 20
88 88 77 77 344 1 2 1000
45 78 96 54 45 11 12 3
Code: Select all
349.45 109.22 53688.44 0.00
45.00 4.24 3.00 3.00
sorry, buddy
215.41 0.96 0.32 1.68
215.41 0.96 10.32 11.68
215.41 0.96 7.32 8.68
215.41 0.96 -0.68 0.68
54.59 0.96 11.32 12.68
54.59 0.96 10.32 12.68
54.59 0.96 11.32 11.68
234.59 0.96 1.68 0.32
35.41 0.96 9.68 8.32
0.00 1.00 4.00 1.00
0.00 0.50 2.50 1.00
sorry, buddy
180.00 0.50 2.50 1.00
90.00 1.00 4.00 3.00
90.00 0.20 4.00 2.20
90.00 0.50 4.00 1.50
140.68 3.57 0.48 5.52
25.09 28.19 63.06 68.91
sorry, buddy
120.00 20.49 -9.49 47.49
28.55 2.70 99.42 123.48
21.46 2.32 6.32 3.70
24.85 1.49 6.71 6.25
227.74 9.08 -4.21 -6.43
250.93 6.81 83.55 75.12
sorry, buddy

i tried 2 find the values of X,Y by the following way:
Y= m*X - m*Px + Py
while m is the slope of the line.
dist(X,Y,Cx,Cy)/v = dist(X,Y,Px,Py)/u
or, u^2* { (X-Cx)^2 + (Y-Cy)^2 } = v^2* { (X-Px)^2 + (Y-Py)^2 }
or, u^2* { (X-Cx)^2+ (m*X - m*Px+ Py-Cy)^2 } =
v^2 *{ (X-Px)^2 + (m*X- m*Px)^2 }
from this quadratic eq. get the roots of X & took the point which is closer to (Px,PY). but this is not producing the corr. output for any of the inputs of the forum.
pls tell me why i m not going in the right way?
Y= m*X - m*Px + Py
while m is the slope of the line.
dist(X,Y,Cx,Cy)/v = dist(X,Y,Px,Py)/u
or, u^2* { (X-Cx)^2 + (Y-Cy)^2 } = v^2* { (X-Px)^2 + (Y-Py)^2 }
or, u^2* { (X-Cx)^2+ (m*X - m*Px+ Py-Cy)^2 } =
v^2 *{ (X-Px)^2 + (m*X- m*Px)^2 }
from this quadratic eq. get the roots of X & took the point which is closer to (Px,PY). but this is not producing the corr. output for any of the inputs of the forum.
pls tell me why i m not going in the right way?
@sunny: Your approach is basically right, but there is so much room for error (I finally found a missing '-' somewhere). Another thing - are you looking at them as lines or as rays?
Just to correct Emilio's output: My output is almost the same as his, except for this input:
My AC program outputs
instead of "sorry, buddy". I think mine is correct (If cheetah is going twice as fast as the prey, it can make up that distance in less than 100 secs, no matter what direction).
Just to correct Emilio's output: My output is almost the same as his, except for this input:
Code: Select all
1
12 11 33 5 345 1 2 100
Code: Select all
344.53 21.84 54.09 -0.65