CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » August 2010 Challenge » Obstacle Course

Obstacle Course

Problem code: COURSE

  • All Submissions

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.

sample 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


  • Submit

Comments

  • Login or Register to post a comment.

Is there a single blank line

Gaurav Rai @ 1 Aug 2010 07:05 PM

Is there a single blank line after no. of test cases & after each test case in input?

@Gaurav: yes, except for no

pieguy @ 1 Aug 2010 09:27 PM

@Gaurav: yes, except for no blank line after the final testcase.

if ans is coming out to be

ravigupta @ 1 Aug 2010 11:08 PM

if ans is coming out to be 2.7625, then what should be printed 2.763 or 2.762?

@Ravi: the test cases were

pieguy @ 2 Aug 2010 01:33 AM

@Ravi: the test cases were chosen so that small precision errors will not effect the result.

is more than 1 cones can lie

v_new.c @ 2 Aug 2010 02:46 AM

is more than 1 cones can lie on same radial line inside track?

anyone plese tell me.

is there a blank line after

dabbcomputers @ 2 Aug 2010 03:09 AM

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

mcsharma1990 @ 2 Aug 2010 03:33 AM

@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

triplem @ 2 Aug 2010 05:30 AM

@atul: all restrictions on the locations of the cones are specified in the input.

is there a cone on same line

theeporithirumugam @ 2 Aug 2010 12:48 PM

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

archie004 @ 2 Aug 2010 03:17 PM

i have the same question as radhakrishnan.

@David Stolp: You said, "the

opeth @ 2 Aug 2010 03:44 PM

@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

pieguy @ 2 Aug 2010 11:12 PM

@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

calc_saransh @ 3 Aug 2010 10:32 AM

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

dabbcomputers @ 3 Aug 2010 02:51 PM

@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

vij.patil @ 3 Aug 2010 10:52 PM

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

NRNishant @ 4 Aug 2010 12:05 AM

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

gomsi_ @ 4 Aug 2010 06:02 PM

@mahesh: how u make ur code handle unexpected line gaps?? plz xplain.

when rounded off 2.72 will be

RVA @ 5 Aug 2010 01:26 AM

when rounded off 2.72 will be ouput not 2.720 @admin pls explain

@all can someone reply to my

RVA @ 5 Aug 2010 01:36 AM

@all can someone reply to my Q pls

got it use printf not cout

RVA @ 5 Aug 2010 05:37 PM

got it use printf not cout

what does 'infinitely

rj_rohit @ 6 Aug 2010 04:18 PM

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

raunak @ 6 Aug 2010 07:13 PM

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

kedar-gupte @ 6 Aug 2010 08:30 PM

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

suba @ 6 Aug 2010 10:15 PM

im gettin the same output for the given sample test case..stil on submission im gettin as wrong output.. plz help me..

@rohit: "infinitely

pieguy @ 6 Aug 2010 11:04 PM

@rohit: "infinitely maneuverable" means the car can change direction without changing position (i.e. make very sharp turns).

Hi Can anybody give me some

vij.patil @ 7 Aug 2010 12:18 PM

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

cegprakash @ 7 Aug 2010 01:07 PM

do size refer to the area of the car?

cones will always be placed

cegprakash @ 7 Aug 2010 01:30 PM

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

riddle88 @ 7 Aug 2010 01:47 PM

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

triplem @ 7 Aug 2010 01:57 PM

@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

cegprakash @ 7 Aug 2010 04:03 PM

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

cegprakash @ 7 Aug 2010 04:51 PM

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

muke @ 8 Aug 2010 02:55 PM

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

triplem @ 8 Aug 2010 04:35 PM

Distinct means no two cones are in exactly the same place.

plzz explain the logic to

calc_saransh @ 11 Aug 2010 03:02 PM

plzz explain the logic to this... i donnno y i was getting WA...

A certain diameter car can

triplem @ 11 Aug 2010 03:47 PM

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

pdwd @ 11 Aug 2010 03:54 PM

Or do something similar to Cruscal algorithm (while two rings are not at the same component).

anyone explain some clear

v_new.c @ 18 Aug 2010 04:40 PM

anyone explain some clear idea for solving this please.

Have you read the August

triplem @ 19 Aug 2010 10:29 AM

Have you read the August 2010 Contest Problem Editorials?

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com