Submit  All submissions  Best solutions  Back to list 
SMPCIRC  Two Circles 
Given two circles: O1 with the center o1 = (x_{o1}, y_{o1}) and a radius r1 and O2 with the center o2 = (x_{o2}, y_{o2}) and radius r2, please compute if O1 is inside O2 or if O2 is inside O1.
Input description
First t < 1000, the number of test cases. In each of the following t lines, 6 integers: x_{o1} y_{o1} r1 x_{o2} y_{o2} r2. Where 0 ≤ x_{o1}, y_{o1}, x_{o2}, y_{o2} ≤ 10000 and 0 < r1, r2 ≤ 10000.
Output description
For each test case print one character:
I, if O1 is inside O2 (or if O2 is inside O1),
E, if O1 is internally tangent to O2 (or if O2 is internally tangent to O1),
O, in other cases.
Example
Input: 2 103 104 5 100 100 10 103 104 10 100 100 10 Output: E O
Added by:  kuszi 
Date:  20130826 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Public source code since:  20130826 11:53:40 
hide comments
20140830 17:57:10 kuszi
@All I do apologize, the problem statement was completely misleading. 

20140830 17:32:42 kuszi
@Djordje Ivanovic. There are two issues in your code: 1. Do not use floating point numbers in this problem. All numbers here are integers and you can compute using integers (square root function is not required for comparison). 2. You can simplify the solution if you will do this "in place". Additional memory to remember all numbers in arrays is nothing but wasting it. Process in the way:


20140829 18:54:09 Djordje Ivanovic
My code perfectly works on example but it says wrong answer??? 

20140211 22:43:08 kuszi
@haha ttpro: In your submission 11044933 there is at least one bug: you truncate float value into int (line 47). BTW: Comparison of floats is quite tricky in the way you do it. 

20140211 16:12:17 haha ttpro
Input: 2 103 104 5 100 100 10 103 104 10 100 100 10 Output: E O i got it, but it keep saying wrong answer 

20140105 02:28:40 kuszi
@Erben Please consider point (106, 108) which is the only one common for both circles. The rest of O1 is inside O2, thus it is internally tangent to O2 

20140105 00:02:43 Erben
Is this example true?I think, 103 104 5 100 100 10 must be I Last edit: 20140105 00:03:07 

20131227 01:39:25 Srinivas
Are there any special cases we should be aware of? Unable to get a right answer submitted 