#C2797. Unique Combo Sum

    ID: 46152 Type: Default 1000ms 256MiB

Unique Combo Sum

Unique Combo Sum

Given a list of orders represented by integers, compute unique combo values by summing every three consecutive orders. Formally, for each index \(i\) (where \(0 \le i \le n-3\)), calculate the sum
\(S_i = a_i + a_{i+1} + a_{i+2}\).
The task is to output the sorted list of all unique sums.

If the number of orders \(n\) is less than 3, no valid combo can be formed and the output should be an empty line.

For example, given the orders [1, 2, 3, 4, 5, 6], the three consecutive sums are 6, 9, 12, and 15 which results in the output: 6 9 12 15.

inputFormat

The input is given in two lines:

  • The first line contains an integer \(n\), the number of orders.
  • The second line contains \(n\) space-separated integers representing the order values.

outputFormat

Output the sorted unique combo sums separated by a space. If no combo can be formed (i.e. when \(n < 3\)), output an empty line.

## sample
6
1 2 3 4 5 6
6 9 12 15