DMOPC '19 Contest 3 P1 - Mode Finding

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

You are given N numbers, a_1, a_2, \dots, a_N. Output all the modes of this list on a single line from least to greatest. The mode of a list is/are the value(s) that appear(s) the most times relative to the other values in the list. It is guaranteed that at least one mode exists.

Constraints

In all tests,
1 \le N \le 10^6
-10^5 \le a_i \le 10^5

Input Specification

The first line contains one number, N.
The second line contains N spaced integers, a_i, the numbers in this list.

Output Specification

On one line, output the modes of the N numbers in increasing order.

Sample Input

10
9 2 9 6 8 7 1 3 9 6

Sample Output

9

Comments


  • 0
    cyberboost  commented on April 8, 2024, 10:00 p.m.

    Why is my code timing out?


  • 0
    Mystical  commented on June 8, 2020, 9:58 p.m.

    Can someone check my submission? https://dmoj.ca/src/2135529 I've tried dozens of test cases and they all seem to work fine but I'm still getting WA.


    • 1
      chika  commented on June 8, 2020, 10:08 p.m.

      You fail this case:

      2
      2 11

      • 2
        Mystical  commented on June 8, 2020, 10:22 p.m. edit 3

        Thanks, fixed. The issue was that the numbers were being sorted alphabetically instead of numerically...