Obstacle CourseProblem code: COURSE |
All submissions for this problem are available.
A number of traffic cones have been placed on a circular racetrack to form an obstacle course. You are asked to determine the largest sized car that can navigate the course. For simplicity, the cones are assumed to have zero width and the car is perfectly circular and infinitely maneuverable. The track itself is the area between 2 concentric circles.
Formally, the course can be navigated by a car of radius c if there exists a closed loop around the center of the track which lies between the circles forming the track, and every point on the loop is at least c distance away from each cone and each boundary of the track.
Input:
Input begins with an integer T (about 25), the number of test cases. Each test case begins with 2 integers r and R (1<=r<R<=25000). The racetrack is the area between the circles centered at (0,0) with radii r and R. The next line of input contains an integer N (0<=N<=500), the number of cones. N lines follow, each containing the coordinates of a cone. The coordinates are integers, and are guaranteed to lie within the track, and be distinct. Cases are separated by a blank line.
Output:
For each input, output on a single line the diameter of the largest car that can navigate the course, rounded to 3 decimal places.
Sample input:
1 5 10 3 6 0 5 7 -2 -7
Sample output:
2.720
Explanation:
The image below shows the course corresponding to the sample input. The black circles represent the boundaries of the racetrack, the small dots the cones, and the filled red circle the car. Also shown is one possible path of the car through the course.
| Author: | pieguy |
| Date Added: | 9-06-2010 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Is there a single blank line
Is there a single blank line after no. of test cases & after each test case in input?
@Gaurav: yes, except for no
@Gaurav: yes, except for no blank line after the final testcase.
if ans is coming out to be
if ans is coming out to be 2.7625, then what should be printed 2.763 or 2.762?
@Ravi: the test cases were
@Ravi: the test cases were chosen so that small precision errors will not effect the result.
is more than 1 cones can lie
is more than 1 cones can lie on same radial line inside track?
anyone plese tell me.
is there a blank line after
is there a blank line after the case or before the case
means
either:
1
............................................blank line
5 10
..........so on...
or
1
5 10
.........so on .
..............................................blank line.....
which one is correct???
@amritpal and ravi you should
@amritpal and ravi
you should not bother about these line gaps, if you are using language like C. Otherwise you should always make your code smart enough so that it handle unexpected line gaps well.
@atul: all restrictions on
@atul: all restrictions on the locations of the cones are specified in the input.
is there a cone on same line
is there a cone on same line ie. if there is a cone on (0,5) is there any other cone in range (0,6<i<R)
i have the same question as
i have the same question as radhakrishnan.
@David Stolp: You said, "the
@David Stolp:
You said, "the test cases were chosen so that small precision errors will not effect the result."
For the given test case, my answer is coming out to be 2.721. Will that be considered a wrong answer or is that being neglected as a small precision error?
@Opeth: You would receive
@Opeth: You would receive wrong answer for that. What I meant is that with an error on the order of 10^-4, you will still print the same result upon rounding.
Just a random question when
Just a random question when does a person get WA ... whenever he gets his first output wrong out of the 25 outputs his program stops is it??? or after calculating all the 25 and then checking ??? i hope this question can be answered... will help me a lot...
@saransh i had design the
@saransh
i had design the same program executor as the codechef which works on local area so I think it is no possible to chk output while the program is running so they check the answer after processing all the test case. but if the first output is wrong they immediately Stop further checking.
Hi, actually when i submit my
Hi, actually when i submit my solution to you, it gave me wrong ans...
but i dont understand why it giving that?? bcoz when i run it will display same output as mentioned in problem..
does output for all test
does output for all test cases should come in a singe line seprated with space or in different lines
@mahesh: how u make ur code
@mahesh: how u make ur code handle unexpected line gaps?? plz xplain.
when rounded off 2.72 will be
when rounded off 2.72 will be ouput not 2.720 @admin pls explain
@all can someone reply to my
@all can someone reply to my Q pls
got it use printf not cout
got it use printf not cout
what does 'infinitely
what does 'infinitely maneuverable' signify here?
Also, Is it possible that there are more than one cone at a particular radii?
eg. cones with coordinates (7,0) and (8,0)..??
Hey! could anyone give me
Hey!
could anyone give me some more test input samples along with their corresponding correct output..
I'm sure my code is logically correct but probably because these guys require the output to be in a certain line, I'm getting a "Wrong Answer" on submission..
can anybody point out the
can anybody point out the maximum memory that the program can take..its giving runtime errors i guess for using more than required ..
im gettin the same output for
im gettin the same output for the given sample test case..stil on submission im gettin as wrong output.. plz help me..
@rohit: "infinitely
@rohit: "infinitely maneuverable" means the car can change direction without changing position (i.e. make very sharp turns).
Hi Can anybody give me some
Hi
Can anybody give me some morsample input..
BCoz my output is same as above, but still it given me wrong ans..
Thanks
do size refer to the area of
do size refer to the area of the car?
cones will always be placed
cones will always be placed at integer co-ordinates????
i want to know whether a cone can be placed at (7.5,8.5)
could you please specify the
could you please specify the output format..as in does there have to be a line break after 1 output or all in the same line separated with space or no spaces at all and in the same line.
@Prakash - this is clearly
@Prakash - this is clearly mentioned in the problem statement.
@pranav - this is also mentioned in the first few words of the 'output' section.
how to increment float?? If
how to increment float?? If i try to increment 0.001 at a time its not accurately incrementing... someone help
I tried with this simple
I tried with this simple code
#include<stdio.h>
int main(){
float a=1,i;
for(i=0;i<10;i++,a-=0.001)
printf("%.10fn",a);
}
the Output i got was
1.0000000000
0.9990000129
0.9980000257
0.9970000386
0.9960000515
0.9950000644
0.9940000772
0.9930000901
0.9920001030
0.9910001159
How to overcome this????
doubt in problem
doubt in problem statement
The coordinates are integers, and are guaranteed to lie within the track, and be distinct
what is meaning of be distinct here is it mean not in same radii
please anybody clarify
Distinct means no two cones
Distinct means no two cones are in exactly the same place.
plzz explain the logic to
plzz explain the logic to this... i donnno y i was getting WA...
A certain diameter car can
A certain diameter car can pass around the track if and only if there is no path from the inner ring to the outer ring, where you are allowed to go from one cone to another (or to a ring) when the distance between them is less than that diameter. Use binary search.
Or do something similar to
Or do something similar to Cruscal algorithm (while two rings are not at the same component).
anyone explain some clear
anyone explain some clear idea for solving this please.
Have you read the August
Have you read the August 2010 Contest Problem Editorials?