Make Triangle
시간 제한2초메모리 제한2048 MB
n개의 양의 정수를 정해진 크기의 세 그룹으로 나눠 세 그룹 합이 넓이가 양수인 삼각형을 이루도록 만든다. 가능한 배치 하나를 출력하거나 NO를 출력한다.
문제
You are given positive integers and three positive integers , , satisfying .
You want to split the n positive integers into three groups, so that:
- The first group contains numbers, the second group contains numbers, the third group contains numbers.
- Let be the sum of the numbers in the first group, be the sum in the second group, and be the sum in the third group. Then , , are the sides of a triangle with positive area.
Determine if this is possible. If this is possible, find one way to do so.
입력
Each test contains multiple test cases. The first line contains an integer () — the number of test cases. The descriptions of the test cases follow.
The first line of each test case contains the integers , , , (, , ) — the number of integers to split into three groups, and the desired sizes of the three groups.
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases does not exceed .
출력
For each test case, print YES if it is possible to split the numbers into three groups satisfying all the conditions. Otherwise, print NO.
If such a split exists, then describe the three groups as follows.
On the next line, print integers — the numbers in the first group.
On the next line, print integers — the numbers in the second group.
On the next line, print integers — the numbers in the third group.
These integers should be a permutation of , and they should satisfy the conditions from the statement.
If there are multiple solutions, print any of them.