#K76227. Process Array Operations

    ID: 34596 Type: Default 1000ms 256MiB

Process Array Operations

Process Array Operations

Problem Statement:

You are given a single-line input containing space‐separated integers. Your task is to perform the following operations on the given array:

  1. Sort the array in non-decreasing order.
  2. Extract the unique elements from the array in sorted order.
  3. Compute the cumulative sum of the array where the cumulative sum is defined as \(S_i = \sum_{j=1}^{i} a_j\).

Output the results of these operations on three separate lines: the first for the sorted array, the second for the unique elements, and the third for the cumulative sum.

inputFormat

Input Format: A single line containing space-separated integers representing the array.

outputFormat

Output Format: Three lines where:

  • The first line contains the sorted array.
  • The second line contains the unique elements in sorted order.
  • The third line contains the cumulative sum of the original array.
## sample
1 2 1 3 2
1 1 2 2 3

1 2 3 1 3 4 7 9

</p>