Problem:
Score : 300 points

Problem Statement

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

Constraints

2 ≤ N ≤ 200000

1 ≤ A_i ≤ 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

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

Sample Input 1

5
2 6 1 4 5

Sample Output 1

YES

The elements are pairwise distinct.

Sample Input 2

6
4 1 3 1 6 2

Sample Output 2

NO

The second and fourth elements are identical.

Sample Input 3

2
10000000 10000000

Sample Output 3

NO

Solution in C++14 (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#include <algorithm>
#include <math.h>
#include <map>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void A_Remaining_Balls(void) {

	string S, T;
	cin >> S >> T;

	int A, B;
	cin >> A >> B;

	string U;
	cin >> U;

	if (S.compare(U) == 0)	A--;
	else					B--;

	cout << A << " " << B;
	return;
}

void B_I_Miss_You(void) {

	string S;
	cin >> S;

	for (int loop = 0; loop < S.size(); loop++) cout << "x";
	cout << flush;
	return;
}

void C_Distinct_or_Not(void) {

	int N;
	cin >> N;

	vector<int> A(N);
	for (int& loop : A) cin >> loop;

	for (int loop1 = 0; loop1 < N; loop1++) {
		for (int loop2 = loop1 + 1; loop2 < N; loop2++) {
			if (A[loop1] == A[loop2]) {
				cout << "NO" << flush;
				return;
			}
		}
	}
	cout << "YES" << flush;
	return;
}

void D_Dice_in_Line(void) {

	int N, K;
	cin >> N >> K;

	vector<int> p(N);
	for (int& it : p) cin >> it;

	int sum = 0;
	for (int loop = 0; loop < K; loop++) sum += p[loop];

	int sumMax = sum;
	for (int loop = 0; loop < N - K; loop++) {
		sum -= p[loop];
		sum += p[(loop + K)];
		sumMax = max(sum, sumMax);
	}

	cout << ((double)sumMax + (double)K) * 0.5 << flush;
	return;
}

void E_Almost_Everywhere_Zero(void) {

	string N;
	cin >> N;
	int K;
	cin >> K;

	int re = 0;
	int length = N.size();
	if (length > K) {

		switch (K) {
		case 1:
			re = length - 1;
			break;
		case 2:
			re = (length - 1) * (length - 2) / 2;
			break;
		case 3:
			re = length * (length - 1) * (length - 2);
			break;
		}
	}
	else {

		cout << 0 << flush;
		return;
	}
}

int main(void) {

	//A_Remaining_Balls();
	//B_I_Miss_You();
	C_Distinct_or_Not();
	//D_Dice_in_Line();
	return 0;
}