#K76227. Process Array Operations
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:
- Sort the array in non-decreasing order.
- Extract the unique elements from the array in sorted order.
- 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.
1 2 1 3 2
1 1 2 2 3
1 2 3
1 3 4 7 9
</p>