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 |
| Tester: | innocentboy |
| Editorial | http://discuss.codechef.com/problems/COURSE |
| 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, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
|
If you are still having problems, see a sample solution here. |

Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section.
bounce!!!
bounce!!!
i m getting rite ans on my
i m getting rite ans on my comp for this prob but while submitting i m getting wrong ans. pls help me to figure whats wrongin my code..
#include <cstdio>
#include <math.h>
using namespace std;
int main()
{
int t,r,rr,n,*a,*b;
float d,l1,l2,ln,le=25000;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d%d%d",&r,&rr,&n);
a=new int [n];
b=new int [n];
for(int j=0;j<n;j++)
{
scanf("%d%d",&a[j],&b[j]);
d=sqrt(a[j]*a[j]+b[j]*b[j]);
l1=d-r;
l2=rr-d;
if (l1>l2)
ln=l1;
else
ln=l2;
if(le>ln)
le=ln;
for(int k=0;k<j;k++)
{
l2=sqrt(((a[j]-a[k])*(a[j]-a[k]))+((b[j]-b[k])*(b[j]-b[k])));
if(le>l2)
le=l2;
}
}
printf("%5.3fn",le);
}
}
thanks in advance.
can anyone explain what we
can anyone explain what we are supposed to find?? i am not even able to get the question?? Thanks in advance..
u need to find the diameter
u need to find the diameter of the largest car that can pass through the area between the concentric circles.
the point of the obstacles are given .so the diameter can vary from r circle boundary to point (on line x=y) or from point to R circle boundary ..
can anyone please explain me
can anyone please explain me the application of prim's algorithm in solving this problem.
i know prim's algorithm but not getting its application in one of the solutions.
Can we modify the way input
hello friends.... the algo
hi @admin i do really think
can anyone help me out.. i am
the deed is done but what's
@admin plz tell us the test
i am getng runtime error in
@author pieguy pls give me 1
Hello All, this question has
Hey All, I am getting "Wrong
this is my code and i m
@doggysaurabh : You need to