Logo
(追記) (追記ここまで)

19246번 - Tribute 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
15 초 512 MB57333060.000%

문제

The Son of Heaven, our beloved emperor, has commanded you, his First Minister, to extort tribute from $n$ neighbouring kingdoms. Each of the tributaries has been assigned a number of silver coins to pay -- for the $i$-th kingdom, the number is $a_i$. To show His infinite grace, the emperor decided to only take money from some of the countries, sparing the rest. Your overzealous finance minister, after writing down all $a_i$'s, has already produced all possible 2ドル^n - 1$ income values -- the sums of the non-empty subsets of tributaries. Unfortunately, the minister lost the paper sheet with original tribute values in the process. For this infraction, as well as improper calligraphy, he was promptly executed.

Now you only have 2ドル^n - 1$ sums, written rather badly. Can you recover the tribute values from them?

입력

The first line of input contains the number of test cases $z$ $(1 \leq z \leq 200)$. The descriptions of the test cases follow.

Every test case consists of two lines: the first contains a number $n$ $(1 \le n \le 20),ドル the second -- 2ドル^n -1$ integers not exceeding 2ドル \cdot 10^9,ドル denoting all the possible sums of tributes. Assume that the tribute values were all positive integers. The total number of sums in all test cases does not exceed 10ドル^7$.

출력

For each test case output the recovered values of $a_i$ for $i = 1, 2, \ldots, n,ドル in increasing order. If there are no values that fit the input, or if there are multiple possibilities, simply write ``\texttt{NO}'' instead -- you cannot execute anyone twice.

제한

예제 입력 1

1
3
1 2 3 3 4 5 6

예제 출력 1

1 2 3

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 1: Jagiellonian U Contest B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /