#K61287. Data Sorted Dictionary

    ID: 31276 Type: Default 1000ms 256MiB

Data Sorted Dictionary

Data Sorted Dictionary

You are given a list of integers. Your task is to create a dictionary (or map) with the following three keys:

  • original: The original list as provided in the input.
  • ascending: The list sorted in ascending order.
  • descending: The list sorted in descending order.

For example, given the input list [4, 2, 9, 1], the expected output is:

{"original": [4, 2, 9, 1], "ascending": [1, 2, 4, 9], "descending": [9, 4, 2, 1]}

The sorting algorithm is expected to achieve a time complexity of \(O(n \log n)\) in average case.

inputFormat

The input is read from standard input (stdin) as a single line containing zero or more space-separated integers. If the line is empty, consider the list to be empty.

Examples of input:

  • 4 2 9 1
  • 1 2 3
  • An empty line (which represents an empty list)

outputFormat

The output should be printed to standard output (stdout) as a JSON formatted string representing a dictionary with exactly three keys: original, ascending, and descending.

Each key must be associated with a list of integers corresponding to the original input, the list sorted in ascending order, and the list sorted in descending order respectively.

## sample
4 2 9 1
{"original": [4, 2, 9, 1], "ascending": [1, 2, 4, 9], "descending": [9, 4, 2, 1]}