3658 - Triangle 3658 - Triángulo 3658 - Triangle

Statistics Sub: 361 | AC: 210 | AC%: 58,17 | Score: 0,86
Created by 2015 Northwest Pacific Regional Contest
Added by kko (2016-06-01)
Limits
Total Time: 12000 MS | Test Time: 1000 MS |Memory: 512 MB | Output: 64 MB | Size: 9 KB
Enabled languages
Available in

Description

Determine if it is possible to produce two triangles of given side lengths, by cutting some rectangle with a single line segment, and freely rotating and flipping the resulting pieces.
Determine si es posible obtener dos triángulos dadas las longitudes de sus lados cortando un rectángulo con un único segmento de línea, rotando y dando la vuelta libremente a las piezas resultantes. 
Determine if it is possible to produce two triangles of given side lengths, by cutting some rectangle with a single line segment, and freely rotating and flipping the resulting pieces.

Input specification

The input consists of two lines. The first line contains three space-separated positive integers, indicating the desired side lengths of the first triangle. Similarly, the second line contains three space-separated positive integers, denoting the desired side lengths of the second triangle. It is guaranteed that the side lengths produce valid triangles. All side lengths are less than or equal to 100.
La entrada está formada por dos líneas. La primera, contiene tres enteros positivos separados por espacio que indican las longitudes deseadas para los lados del primer triángulo. Similarmente, la segunda línea contiene tres enteros positivos separados por espacio, denotando las longitudes deseadas para los lados del segundo triángulo. Se garantiza que las longitudes de los lados siempre producen triángulos válidos. Todas las longitudes son menores o iguales que 100.
The input consists of two lines. The first line contains three space-separated positive integers, indicating the desired side lengths of the first triangle. Similarly, the second line contains three space-separated positive integers, denoting the desired side lengths of the second triangle. It is guaranteed that the side lengths produce valid triangles. All side lengths are less than or equal to 100.

Output specification

Print, on a single line, whether there exists a rectangle which could have been cut to form triangles of the given side lengths. If such a rectangle exists, print YES. Otherwise, print NO.
Imprima en una línea simple, si existe un rectángulo que pueda ser cortado en los triángulos con las longitudes dadas. Si dicho rectángulo existe, imprima YES. En caso contrario, imprima NO.
The input consists of two lines. The first line contains three space-separated positive integers, indicating the desired side lengths of the first triangle. Similarly, the second line contains three space-separated positive integers, denoting the desired side lengths of the second triangle. It is guaranteed that the side lengths produce valid triangles. All side lengths are less than or equal to 100.

Sample input

3 4 5
4 3 5

Sample output

YES

Hint(s)

Sample Input #2
3 4 6
4 6 3

Sample Output #2
NO
Sample Input #2
3 4 6
4 6 3

Sample Output #2
NO
Sample Input #2
3 4 6
4 6 3

Sample Output #2
NO

Recommendation

We have carefully selected several similar problems: 3675 | 3377 | 3515 | 1960 | 2305 | 3091