Professional Documents
Culture Documents
Signup with
Have you tried CodeChefs "Code, Compile & Run" Its pretty cool. Try it out by pressing Ctrl+; and
typing "ide" [X]
Circle of death
ALL SUBMISSIONS SUBMIT
Problem code: CIRKILL
Like Share 15 people like this. Sign Up to see what your
friends like.
The first line of the input contains an integer T, the number of test cases. The description of T test cases
allan_android 0.00 2.6M C++ 4.3.2 View
follows. The first line of each test case contains a single integer N, the number of tiles in Chefton. The
next N lines consist of 2 space separated integers each, where the i'th line specifies the X and Y co-
ordinates of the i'th tile. princerk 0.00 2.6M C++ 4.3.2 View
Output View
kaushal67 0.00 2.6M C++ 4.3.2
For each test case, output a single line containing the probability that Team Rocket kills Ash. Your
answer is considered correct if it has an absolute error less than 10-6. ouditchya_713 0.00 2.6M C++ 4.3.2 View
Constraints
bha4347 0.00 2.8M C++ 4.3.2 View
1 T 10
4 N 30
-50 X, Y 50 1 of 7
All (X,Y) in a test case are unique.
Sample
Input HELP
2
4
-1 0
00
01
10
5
-1 0
0 -1
00
01
10
Output
0.25
0.4
Explanation
Test 1: There are 4 ways TR may be placed. Each one of them has the probability 0.25, of occuring.
{ (-1,0), (0,0), (0,1) }, Ash is at (1,0). Ash cannot be killed even though TR has a valid and unique
"kill circle".
{ (-1,0), (0,0), (1,0) }, Ash is at (0,1). Ash cannot be killed because TR does not have a unique "kill
circle".
{ (-1,0), (0,1), (1,0) }, Ash is at (0,0). Ash can be killed since he is standing inside TR's "kill circle".
{ (0,0), (0,1), (1,0) }, Ash is at (-1,0). Ash cannot be killed even though TR has a valid and unique
"kill circle".
converted by W eb2PDFConvert.com
Test 2: There are 10 ways TR may be placed. Each one of them has the probability 0.1, of occuring. For
each one of those placements, Ash may be placed at one of the 2 remaining positions. Thus, with
probability 0.05 each, there are 20 total arrangements to consider. Ash can be killed by TR in 8 of these Program should read from standard input and write to
20 cases. standard output. After you submit a solution you can see
your results by clicking on the [My Submissions] tab on
Author: kaushik_iska the problem page. Below are the possible results:
Tester: gamabunta
Accepted Your program ran successfully and
Editorial http://discuss.codechef.com/problems/CIRKILL gave a correct answer. If there is a score for the
problem, this will be displayed in parenthesis next to
Date Added: 9-06-2013 the checkmark.
Time Limit: 1 sec
Time Limit Exceeded Your program was
Source compiled successfully, but it didn't stop before time
50000 Bytes limit. Try optimizing your approach.
Limit:
ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.8.1, CPP11, Wrong Answer Your program compiled and ran
Languages: CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, succesfully but the output did not match the expected
NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH output.
3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC
@hinu there is a discussion where different links for learning c and c++ has been provide the link is
as below http://discuss.codechef.com/questions/10471/references-for-learning-c hope u learn and
enjoy coding on codechef
nice one
what do you mean by a unique kill circle..there will obviously be a unique circle through any 3 non-
collinear points...by that condition does the question mean to say that the 3 points are not collinear
@codingwizard :- Yes. Look at the third case of Test 1. The members of TR stand in a straight line.
Since they are in a co-linear arrangement, no "unique" circle can be formed.
converted by W eb2PDFConvert.com
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