LCC '23 Contest 1 J2 - Costume Scores

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Shane wanted to enter a halloween costume contest; however, he just missed the registration. A list of N participants had signed up for the contest and each participant has a score a_i, not inclusive of Shane. He wants to figure out his placement in the contest and also the highest and lowest scores if he had entered the contest.

Input Specification

The first line of input will contain two space-separated integers N (1 \le N \le 10^6) and S (1 \le S \le 10^9), representing the number of participants in the contest and Shane's score respectively.

The second line of input will contain N space-separated integers a_i (1 \le a_i \le 10^9), representing the score of the i-th participant.

Output Specification

The first line of output should be Shane's placement in the contest. If there is a tie, output the better placement.

The second line of output should be two space-separated integers of the highest and lowest scores of the contest.

Subtasks

Subtask 1 [20%]

1 \le N \le 10^3

1 \le a_i \le 10^6

Subtask 2 [80%]

1 \le N \le 10^6

1 \le a_i \le 10^9

Sample Input 1

5 4
3 1 4 1 5

Sample Output 1

2
5 1

Sample 1 Explanation

The order of the scores from highest to greatest in the contest are [5, 4, 4, 3, 1, 1]. Thus, Shane's score of 4 ties for 2^{nd}. The highest score in the contest is 5 and the lowest score is 1.

Sample Input 2

3 3
1 2 3

Sample Output 2

1
3 1

Comments

There are no comments at the moment.