AIOC Banner

Problem: Concealed Coconut

Want to try solving this problem? You can submit your code online if you log in or register.

Concealed Coconut

Input File: cocoin.txt
Output File: cocoout.txt
Time Limit: 1 second
Memory Limit: 1 GB

Ishraq and Clement have lost their coconut and need help finding it again!

Ishraq, Clement and the coconut are standing on a 2d-plane. The locations of Ishraq and Clement are given by their x- and y-coordinates, where x and y are whole numbers.

Both Ishraq and Clement think they know how far away from the coconut they are, but in their sadness their memory may be wrong. Given the location of Ishraq and Clement, and their respective distances to the coconut, figure out whether there is at least one location that the coconut could be. Note that the distance from each person to the coconut will also be a whole number.


The first line will contain Ishraq's location, followed by his distance to the coconut; Ix, Iy and Id respectively. The second line will contain Clement's location, followed by his distance to the coconut; Cx, Cy and Cd respectively.


If there is at least one location that the coconut could be in, your program should output 'yes', otherwise it should output 'no'.

Sample Input 1

1 2 3
6 8 4

Sample Output 1


Explanation 1

The circles in the diagram give the points where the coconut could be given Ishraq and Clement's distances. Since these circles share no points there are no places where the coconut could be, so the result is 'no'.

Sample Input 2

0 0 15
17 6 10

Sample Output 2


Explanation 2

Given the diagram, we can see that there are two points that are distance 15 from Ishraq at (0,0) and distance 10 from Clement at (17,6). Their actual locations do not matter, we only need to determine if possible locations exist, so the result is 'yes'.

Sample Input 3

0 0 5
6 8 5

Sample Output 3


Explanation 3

There is exactly one possible location for the coconut (3, 4), so the answer is 'yes'.

Sample Input 4

1 1 10
1 2 3

Sample Output 4


Explanation 4

In this case Clement's circle lies completely inside Ishraq's, so there is no possible place for the coconut to be. Therefore the answer is 'no'.

Subtasks & Constraints

For all cases, 0 < Ix, Iy, Id, Cx, Cy, Cd < 10,000.


Privacy statement
© Australian Mathematics Trust 2001-2023

Page generated:  3 June 2023,  3:05pm AEST