#K91897. Median of Big-O Notations

    ID: 38077 Type: Default 1000ms 256MiB

Median of Big-O Notations

Median of Big-O Notations

In this problem, you are given a set of T time complexity notations in Big-O format. The available notations are:

  • $O(1)$
  • $O(\log N)$
  • $O(N)$
  • $O(N\log N)$
  • $O(N^2)$
  • $O(2^N)$

Your task is to sort the given notations according to the above increasing order of time complexity and then output the median value. Note that if the number T is even, you should choose the left median (i.e. the element at index $\frac{T}{2} - 1$ when indexing from 0).

For example, if T = 3 and the notations are O(N), O(\log N), and O(N^2), the sorted order will be O(\log N), O(N), O(N^2) and the median is O(N).

inputFormat

The input is given via standard input (stdin). The first line contains an integer T representing the number of time complexity notations. Each of the next T lines contains one Big-O notation, which is one of the following: O(1), O(\log N), O(N), O(N\log N), O(N^2), or O(2^N).

outputFormat

The output is a single line (stdout) containing the median Big-O notation after sorting the given list according to the predefined order. If T is even, output the left median.

## sample
1
O(N)
O(N)

</p>