Vous êtes sur la page 1sur 4

Login Signup Login or

Signup with
Have you tried CodeChefs "Code, Compile & Run" Its pretty cool. Try it out by pressing Ctrl+; and
typing "ide" [X]

PRACTICE COMPETE DISCUSS COMMUNITY HELP ABOUT

Home Practice(easy) Obstacle Course

Obstacle Course
ALL SUBMISSIONS SUBMIT
Problem code: COURSE
Like Share 13 people like this. Sign Up to see what your
friends like.

All submissions for this problem are available. SUCCESSFUL SUBMISSIONS


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 User Time Mem Lang Solution
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 karlheinz_jung 0.08 1.6M C View
is the area between 2 concentric circles.
Formally, the course can be navigated by a car of radius c if there exists a hariram 0.08 1.6M C View
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 sid1505 0.08 1.6M C View
boundary of the track.
Input: microbotz 0.08 1.6M C View

Input begins with an integer T (about 25), the number of test cases. View
sanketgarg 0.08 1.6M C
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.
lehar_1106 0.08 2.2M C View
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. anup 0.09 1.6M C View
Cases are separated by a blank line.
divyabatra 0.09 1.6M C View
Output:
For each input, output on a single line the diameter of the largest car that g1g19 0.09 1.6M C View
can navigate the course, rounded to 3 decimal places.
Sample input: shubhamkr1 0.09 1.6M C View

1
shiwam23 0.09 1.6M C View
5 10
3 View
60 tushariitkgp 0.09 2.2M C
57
-2 -7
1 of 7
Sample output:
2.720
Explanation:
HELP
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 50000 Bytes
Limit:

converted by W eb2PDFConvert.com
Program should read from standard input and write to
ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.8.1, CPP11, standard output. After you submit a solution you can see
Languages: CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, your results by clicking on the [My Submissions] tab on
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 the problem page. Below are the possible results:

Accepted Your program ran successfully and


gave a correct answer. If there is a score for the
Comments problem, this will be displayed in parenthesis next to
the checkmark.
Please login at the top to post a comment.
Time Limit Exceeded Your program was
ritwick @ 13 Aug 2010 11:00 PM compiled successfully, but it didn't stop before time
limit. Try optimizing your approach.
bounce!!!
Wrong Answer Your program compiled and ran
succesfully but the output did not match the expected
output.
akash_d_learner @ 21 Aug 2010 04:04 AM
Runtime Error Your code compiled and ran but
i m getting rite ans on my comp for this prob but while submitting i m getting wrong ans. pls help me encountered an error. The most common reasons are
to figure whats wrongin my code.. using too much memory or dividing by zero. For the
specific error codes see the help section.

#include <cstdio> Compilation Error Your code was unable to


#include <math.h> compile. When you see this icon, click on it for more
using namespace std; information.
int main()
{ If you are still having problems, see a sample solution
here.
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.

mukulbudania @ 1 Sep 2010 10:33 PM

can anyone explain what we are supposed to find?? i am not even able to get the question?? Thanks
in advance..

jyotigupta2203 @ 18 Oct 2010 12:09 AM

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

tarun_kumar @ 23 Nov 2010 07:29 PM

converted by W eb2PDFConvert.com
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.

meher_almighty @ 2 Aug 2011 09:56 PM

Can we modify the way input is taken? or is it have to be in the exact same way given above?

abhipranay @ 14 Dec 2011 02:24 PM

hello friends.... the algo which i am following seems right to me to solve this problem but i am getting
wrong answer on submission. for sample input my answer is correct.

konvimartial @ 20 Jun 2012 08:16 PM

hi @admin i do really think that there is an error with the test cases of this exercice,it sending me a
wrong answer(more than ones) despite a have make an input file of my own where i think i really
take the most extreme cases and it gives me correct answer can you guy actually verify the test
cases please!!

madhavan @ 25 Aug 2012 01:04 AM

can anyone help me out.. i am new here.. I am getting correct answer for the sample input given
above on my PC ,but when i submit it ..it gives me a runtime error msg.. Is there some problem with
the program or what.. ? I have written this program in java..

blueflamebisla @ 22 Sep 2012 01:28 AM

the deed is done but what's up with the java I/O of these guys. it's not taking the input the way it
should.... bad management guys.. at least show us the WRONG output for debugging...
DISAPPOINTED

adlakhapiyush @ 22 Oct 2012 11:21 PM

@admin plz tell us the test case so that we cn figure out the problem bcoz its not giving write answer
to most of us.

harsh93 @ 25 Nov 2012 10:39 PM

i am getng runtime error in it..plz can any1 explain y ?? #include #include int main() {float tem,d[4]=
{0},D[4]; int co[4][2],i,j,c,r,R,k ,t; scanf("%d",&t); while(t--) {scanf("%d%d%d",&R,&r,&c);for(i=0;i(d[k]-r))
{D[k]=(R-d[k]);} else{D[k]=(d[k]-r);}k++;} for(i=0;iD[j]){ tem=D[i]; D[i]=D[j]; D[j]=tem;}}}printf("%fn",D[c-
1]);}return 0;}

vish4071 @ 31 Dec 2012 06:16 PM

@author pieguy pls give me 1 or 2 test cases for which my code is wrong... id: 1657175

manmohanvyas @ 14 Jan 2013 10:21 PM

Hello All, this question has problem with inputs , it can be proved by Making two programs in java,
one taking input by Scanner other by BufferedReader. one with buffered reader will always give you
RUNTIME ERROR(non-zero exit code).

paradigmwit @ 14 Feb 2013 05:24 PM

Hey All, I am getting "Wrong Answer" for my solution. Any pointers to what i am doing wrong will be
appreciated. My code is at here - http://www.codechef.com/viewsolution/1839873

doggysaurabh @ 23 Feb 2013 05:30 PM

this is my code and i m getting runtime error import java.util.*; public class obstrk{ public static
double sqr(int a){ return a*a; } public static double modulus(int a, int b){ return
Math.sqrt(sqr(a)+sqr(b)); } public static double max(double n1, double n2 ){ if (n1

vineetpaliwal @ 23 Feb 2013 05:41 PM

@doggysaurabh : You need to name the file as Main.java and the class as Main in which the public
static void main(... method should reside . Otherwise codechef judge will throw , "No Main class
found" exception and hence a runtime error .

jyoti_kumari47 @ 14 Aug 2013 05:10 PM

converted by W eb2PDFConvert.com
m 2 getting wrong answer for my solution though it matches with the one given except that my sol is
2.72 as i used setprecision upto 3 decimal places but in eg its given 2.720.

chomu1850 @ 30 Aug 2013 01:32 AM

there are some cases like if there are two or more than two obstacles in the same line;........ also
there is possible test case of no obstacle ;,,,,,,,,, keep these two things in mind

newboy11 @ 6 Apr 2014 06:19 PM

http://www.codechef.com/viewsolution/3703650 This is my solution. I have made sure that I consider


the case when no. of obstacle =0 and when more than one obstacle is placed in same line but still it
shows wrong answer. Please anybody can help me in doing it correctly i would be thankful.

a1z73 @ 30 Jun 2014 10:23 PM

http://www.codechef.com/viewsolution/4167051 here is the link to my solution.i'm getting the correct


answer on my machine, but here i'm getting a wrong answer,can someone pls explain?!

a1z73 @ 30 Jun 2014 10:24 PM

http://www.codechef.com/viewsolution/4167051 here is the link to my solution.i'm getting the correct


answer on my machine, but here i'm getting a wrong answer,can someone pls explain?!

lovjit @ 8 Sep 2014 11:26 AM

I am getting "Runtime error NZEC".I am unable to find my mistake.Could anybody help me in figuring
out the mistake. Please find the source code at the link:
http://www.codechef.com/viewsolution/4756071

kapil_chopra @ 6 Oct 2014 03:57 PM

I am getting a wrong answer. My code is working fine and giving correct answer on my PC. Please
help me. My code is http://www.codechef.com/viewsolution/5022417

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 The time now is: 01:18:38 PM
In order to report copyright violations of any kind, send in an email to copyright@codechef.com Your Ip: 50.97.53.242

CodeChef - A Platform for Aspiring Programmers


CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to
revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have
training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions,
CodeChef also has various algorithm 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 programming contest judge accepts solutions in over 35+
programming languages. Preparing for coding contests were 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 challenges 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 coding contest and the shorter format Cook-off coding contest. Put yourself
up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.
Discuss
Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other
programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the
CodeChef Forums and Wiki section.
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. You can also host a coding contest for your institute on CodeChef, organize an algorithm event 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.

converted by W eb2PDFConvert.com

Vous aimerez peut-être aussi