問題一覧 > 通常問題

No.1692 Expectations

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 236
作問者 : eSeF / テスター : first_vil ygussany
お気に入りにしたユーザー ProblemId : 5196 / 自分の提出
問題文最終更新日: 2021-09-29 17:45:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 316 (順位表) の他の問題:

Problem Statement

There is a game with $N$ participants. They are called Person 1, Person 2, ..., Person $N$.

Now, there is 1 copy of each integer between $1$ and $M$, inclusive. $N$ of these are chosen and given to the $N$ people, $1$ to each person.

SF-kun, who is watching this game, wants to guess which integer each person has. So he has made $N$ guesses. The $i$-th guess is as follows.

  • The integer that Person $i$ has is $A_i$.

Find the maximum and minimum possible number of correct guesses among SF-kun's guesses. Here, a correct guess means an integer $i$ such that the integer Person $i$ actually has is $A_i$.

Input

$N\ \ M$
$A_1\ \cdots \ A_N$
【Constraints】
  • $1\le N\le M\le 2\times 10^5$
  • $1\le A_i\le M$
  • All input values are integers.

Output

Print the maximum $\max$ and the minimum $\min$ of the number of correct guesses among SF-kun's guesses on one line, separated by a space, as follows.
$\max\ \ \min$

Sample

Sample 1
Input
3 5
1 2 1
Output
2 0

For example, if the integers the three people have are (Person 1, Person 2, Person 3)$=(4,2,1)$, two guesses are correct. On the other hand, if all the guesses were correct, there would be two copies of $1$, which is impossible. Therefore, the maximum number of correct guesses is $2$.

All the guesses can be wrong, for example when the integers they have are $(2,3,5)$. Thus, the minimum is $0$.

Sample 2
Input
8 8
7 1 2 5 8 3 4 6
Output
8 0

It is possible for all the guesses to be correct, and it is also possible for all of them to be wrong.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。