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

19073번 - Subsequence Sums 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB61352560.976%

문제

Yuta has a sequence of $n$ positive integers $A_1, \ldots, A_n,ドル and their sum is $m$. For each subsequence $S$ of $A,ドル he calculated the sum of elements in this subsequence.

So, now Yuta has also got 2ドル^n$ integers between 0ドル$ and $m$. For each $i \in [0, m],ドル let $B_i$ be the number of integers $i$ he got.

Yuta shows you the array $B_i,ドル and he asks you to restore $A_1, \ldots, A_n$. If there are several possibilities, find the lexicographically smallest possible sequence.

입력

The first line of the input contains two integers $n$ and $m$ (1ドル \leq n \leq 50,ドル 1ドル \leq m \leq 10^4$).

The second line contains $m + 1$ integers $B_0, \ldots, B_m$ (0ドル \leq B_i \leq 2^n$).

출력

Print a single line with $n$ integers $A_1, \ldots, A_n$.

It is guaranteed that there exists at least one solution. And if there are several possible solutions, print the lexicographically smallest one.

제한

예제 입력 1

2 3
1 1 1 1

예제 출력 1

1 2

예제 입력 2

3 3
1 3 3 1

예제 출력 2

1 1 1

힌트

In the first example, $A$ is $[1, 2]$. $A$ has four subsequences $[],ドル $[1],ドル $[2]$ and $[1,2],ドル and the sums for them are 0ドル,ドル 1ドル,ドル 2ドル$ and 3ドル$. So, $B = [1, 1, 1, 1]$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 4: Ruyi Ji Contest 2 H번

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

출처

대학교 대회

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

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