시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 37 13 9 33.333%

문제

N(1≤N≤20)개의 반원 모양의 철사들이 있다. 이들 중 몇 개를 택해서 붙였을 때, 하나의 연결된 모양(폐곡선)을 만들 수 있는지 알아내는 프로그램을 작성하시오. 두 개의 반원 모양의 철사는 그 끝을 임의의 각도로 붙일 수 있지만(즉, 각각의 반원을 얼마든지 회전할 수 있다), 중간에 다른 철사와 겹치는 부분이 있어서는 안 된다.

입력

첫째 줄에 데이터의 개수 K(1≤K≤30)가 주어진다. 각 데이터의 첫째 줄에는 N이 주어지고, 그 다음 줄에는 각 반원의 반지름을 나타내는 실수가 N개 주어진다. 각 실수는 0부터 10,000,000의 범위 안에 있으며, 소숫점 아래 셋째 자리까지 입력될 수 있다.

출력

각 데이터에 대해서 가능한 경우에는 YES, 불가능한 경우에는 NO를 출력한다.

예제 입력 1

4
1
4.000
2
1.000 1.000
3
1.455 2.958 4.424
7
1.230 2.577 3.411 2.968 5.301 4.398 6.777

예제 출력 1

NO
YES
NO
YES

힌트

W3sicHJvYmxlbV9pZCI6IjIwNjMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWNjYTBcdWMwYWMgXHVjNWYwXHVhY2IwIiwiZGVzY3JpcHRpb24iOiI8cD48aW1nIHdpZHRoPVwiMzI0XCIgaGVpZ2h0PVwiMjQxXCIgYWx0PVwiXCIgc3JjPVwiXC9KdWRnZU9ubGluZVwvdXBsb2FkXC8yMDEwMDdcL3dpcmUucG5nXCIgXC8+PFwvcD5cclxuPHA+TigxJmxlO04mbGU7MjApXHVhYzFjXHVjNzU4IFx1YmMxOFx1YzZkMCBcdWJhYThcdWM1OTFcdWM3NTggXHVjY2EwXHVjMGFjXHViNGU0XHVjNzc0IFx1Yzc4OFx1YjJlNC4gXHVjNzc0XHViNGU0IFx1YzkxMSBcdWJhODcgXHVhYzFjXHViOTdjIFx1ZDBkZFx1ZDU3NFx1YzExYyBcdWJkOTlcd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