10708 - Cheetah

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan

10708 - Cheetah

Post by htl » Wed Sep 01, 2004 3:59 am

Could someone got ac give some test case? btw, if the cheetah and the prey is in the same position, then C=P?

schindlersp
New poster
Posts: 28
Joined: Tue Aug 03, 2004 8:11 pm
Contact:

10708 -

Post by schindlersp » Thu Sep 02, 2004 5:45 am

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

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Thu Sep 02, 2004 8:04 am

Almost half of your outputs are wrong. Correct output:
[edit]
...can be found below since my had some errors.
[/edit]
Last edited by Per on Thu Sep 02, 2004 9:18 pm, edited 1 time in total.

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Thu Sep 02, 2004 10:27 am

Hi Per, are you sure that the cheetah cannot catch the prey for the 6th case:
2 3 2 4 90 1 2 10
? :-?

Btw, my AC code gives the following 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
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
P.S. Yes, the special judge accepts -0.00.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Thu Sep 02, 2004 11:14 am

I copy observers output (with 0.00 in the fifth case).
I guess you're lucky Per that there's no running along the Y-axis in the judges input...

schindlersp
New poster
Posts: 28
Joined: Tue Aug 03, 2004 8:11 pm
Contact:

10708

Post by schindlersp » Thu Sep 02, 2004 3:04 pm

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 :)

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Thu Sep 02, 2004 9:17 pm

Observer wrote:Hi Per, are you sure that the cheetah cannot catch the prey for the 6th case:
2 3 2 4 90 1 2 10
? :-?
Hmm, yeah, you're right, I don't handle vertical lines correctly. Sorry, should have been more careful when I checked the I/O.

schindlersp
New poster
Posts: 28
Joined: Tue Aug 03, 2004 8:11 pm
Contact:

10708 - Cheetah

Post by schindlersp » Sat Sep 04, 2004 5:24 am

:roll:

if somebody will have an input with some special case will be coming well

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
I distrust that I am deceiving itself in I only calculate it of the angulos



[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.

nafi
New poster
Posts: 11
Joined: Sat Jul 31, 2004 10:35 pm
Location: Dhaka, Bangladesh
Contact:

Post by nafi » Mon Sep 06, 2004 6:19 pm

my AC program gave this output for your input

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
try also these:
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
output:

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
did u consider u==0 , v==0 , C & P are the same point?
nafi

schindlersp
New poster
Posts: 28
Joined: Tue Aug 03, 2004 8:11 pm
Contact:

thanxssss for 10708

Post by schindlersp » Wed Sep 08, 2004 11:23 pm

Thankss :wink:

I just think about asin range.

Artint
New poster
Posts: 1
Joined: Wed Sep 15, 2004 8:28 pm

Post by Artint » Wed Sep 15, 2004 8:31 pm

If the tsk is correct? I've got AC only after changing U to V (first i read V, then U)

User avatar
nealzane
New poster
Posts: 23
Joined: Tue Dec 10, 2002 2:13 am
Location: China
Contact:

Post by nealzane » Tue Feb 15, 2005 10:17 pm

my ac code gives answer to this test:

Code: Select all

45 78 96 54 45 11 12 3 

Code: Select all

sorry, buddy
and it is easy to see if you do some simple drawing
8-)

Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Post by Emilio » Sat Apr 22, 2006 9:46 pm

Some test cases posted by schindlersp are wrong.
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 
Output:

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
Hope it help! :D

sunny
Experienced poster
Posts: 124
Joined: Sun Sep 11, 2005 10:22 pm
Location: Civil-BUET

Post by sunny » Tue Oct 03, 2006 5:16 pm

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?

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko » Fri Feb 02, 2007 3:15 am

@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:

Code: Select all

1
12 11 33 5 345 1 2 100
My AC program outputs

Code: Select all

344.53 21.84 54.09 -0.65
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).

Post Reply

Return to “Volume 107 (10700-10799)”