#C6601. Unique Prefix Sum Sequence

    ID: 50380 Type: Default 1000ms 256MiB

Unique Prefix Sum Sequence

Unique Prefix Sum Sequence

You are given an integer ( n ). Your task is to determine if it is possible to construct a sequence ( a_0, a_1, \dots, a_{n-1} ) such that each prefix sum is unique. A valid solution for ( n \geq 1 ) is to use the sequence defined by ( a_i = 2^i ), which guarantees that each prefix sum is distinct. If ( n ) is less than 1, output ( NO ). When a sequence is possible, the program should output ( YES ) on the first line followed by the sequence (space-separated) on the second line.

inputFormat

The input consists of a single integer ( n ) provided via standard input.

outputFormat

If ( n \ge 1 ), print ( YES ) on the first line and the sequence ( a_0, a_1, \dots, a_{n-1} ) (with elements separated by spaces) on the second line. If ( n < 1 ), print ( NO ).## sample

3
YES

1 2 4

</p>