C - Distinct or Not Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 300300

問題文

整数列 A1,A2,...,ANA_1, A_2, ..., A_N が与えられます。 この整数列のどの 22 つの要素も互いに異なるならば YES を、そうでないなら NO を出力してください。

制約

  • 2N2000002 ≤ N ≤ 200000
  • 1Ai1091 ≤ A_i ≤ 10^9
  • 入力は全て整数

入力

入力は以下の形式で標準入力から与えられる。

NN
A1A_1 ...... ANA_N

出力

整数列のどの 22 つの要素も互いに異なるならば YES を、そうでないなら NO を出力せよ。


入力例 1Copy

Copy
5
2 6 1 4 5

出力例 1Copy

Copy
YES

どの 22 つの要素も互いに異なります。


入力例 2Copy

Copy
6
4 1 3 1 6 2

出力例 2Copy

Copy
NO

22 番目の要素と 44 番目の要素が同じです。


入力例 3Copy

Copy
2
10000000 10000000

出力例 3Copy

Copy
NO

Score : 300300 points

Problem Statement

Given is a sequence of integers A1,A2,...,ANA_1, A_2, ..., A_N. If its elements are pairwise distinct, print YES; otherwise, print NO.

Constraints

  • 2N2000002 ≤ N ≤ 200000
  • 1Ai1091 ≤ A_i ≤ 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN
A1A_1 ...... ANA_N

Output

If the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.


Sample Input 1Copy

Copy
5
2 6 1 4 5

Sample Output 1Copy

Copy
YES

The elements are pairwise distinct.


Sample Input 2Copy

Copy
6
4 1 3 1 6 2

Sample Output 2Copy

Copy
NO

The second and fourth elements are identical.


Sample Input 3Copy

Copy
2
10000000 10000000

Sample Output 3Copy

Copy
NO


2025-04-23 (Wed)
16:22:10 +00:00