AtCoder Beginner Contest 154 - Distinct or Not

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-----
5
2 6 1 4 5

-----Sample Output-----
YES

The elements are pairwise distinct.

Source: atcoder | Difficulty: EASY


Solutions:
N = int(input())
A = list(map(int, input().split()))
print('YES' if len(set(A)) == N else 'NO')


n = int(input())
a = set(input().split())
print('YES' if len(a) == n else 'NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 'YES'
for i in range(n - 1):
	if a[i] == a[i + 1]:
		ans = 'NO'
print(ans)


print('YES' if int(input()) == len(set(input().split())) else 'NO')


n = int(input())
v = list(map(int, input().split()))
print('YNEOS'[len(set(v)) < n::2])


num = int(input())
table = list(map(int, input().split()))
count = 0
list.sort(table)
if num == 2:
	if table[0] == table[1]:
		count += 1
else:
	for i in range(1, num - 1):
		if num == 2:
			if table[0] == table[1]:
				count += 1
		elif table[i] == table[i + 1] or table[i - 1] == table[i]:
			count += 1
		else:
			continue
if count == 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = set(map(int, input().split()))
print('YES' if len(s) == n else 'NO')


n = int(input())
a = list(map(int, input().split()))
ans = len(a)
a1 = set(a)
ans1 = len(a1)
if ans == ans1:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted([int(i) for i in input().split()])
ans = 'YES'
for i in range(1, n):
	if a[i - 1] == a[i]:
		ans = 'NO'
		break
print(ans)


N = int(input())
A = sorted(list(map(int, input().split())))
for i in range(1, N):
	if A[i] == A[i - 1]:
		print('NO')
		Flag = False
		break
	else:
		Flag = True
if Flag:
	print('YES')


n = int(input())
nums = list(map(int, input().split()))
setnum = set(nums)
if len(setnum) == n:
	print('YES')
else:
	print('NO')


input()
l = input().split()
d = set(l)
print('YES' if len(l) == len(d) else 'NO')


input()
li = list(map(int, input().split()))
print('NO' if len(li) > len(set(li)) else 'YES')


(n, *A) = map(int, open(0).read().split())
print('YES' if len(A) == len(set(A)) else 'NO')


from collections import Counter
N = int(input())
Alist = list(map(int, input().split()))
count = Counter(Alist)
flag = True
for value in count.values():
	if value > 1:
		flag = False
print('YES' if flag else 'NO')


n = input()
a = list(map(int, input().split()))
print(['YES', 'NO'][len(set(a)) != len(a)])


import collections
N = int(input())
A = list(map(int, input().split()))
C = collections.Counter(A)
V = C.values()
L = list(V)
for i in range(len(L)):
	if L[i] > 1:
		print('NO')
		return
print('YES')


n = int(input())
a = list(map(int, input().split()))
x = len(set(a))
if x == len(a):
	print('YES')
else:
	print('NO')


N = int(input())
A_ls = map(int, input().split(' '))
rst = set()
for i in A_ls:
	rst.add(i)
if len(rst) == N:
	print('YES')
else:
	print('NO')


def main():
	N = int(input())
	print('YES' if len(set(input().split())) == N else 'NO')

def __starting_point():
	main()
__starting_point()


a = int(input())
s = input().split()
if len(set(s)) == a:
	print('YES')
else:
	print('NO')


N = int(input())
As = sorted(list(map(int, input().split())))
c = 0
for i in range(N - 1):
	c += As[i] == As[i + 1]
print('YNEOS'[c > 0::2])


N = int(input())
A_ls = list(input().split(' '))
rst = {i for i in A_ls}
if len(rst) == N:
	print('YES')
else:
	print('NO')


N = int(input())
A = set((int(i) for i in input().split()))
print('YES' if len(A) == N else 'NO')


N = int(input())
lst = list(map(int, input().split()))
k = list(set(lst))
if len(k) == N:
	print('YES')
else:
	print('NO')


N = int(input())
K = set(input().split())
i = len(K)
if i == N:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
lst = list(map(int, input().split()))
lst.sort()
for i in range(n - 1):
	if lst[i] == lst[i + 1]:
		print('NO')
		return
print('YES')


N = input()
A = input().split()
if len(set(A)) == len(A):
	print('YES')
else:
	print('NO')


n = int(input())
alist = list(map(int, input().split()))
if len(set(alist)) == n:
	print('YES')
else:
	print('NO')


import collections
n = int(input())
a = list(input().split())
c = collections.Counter(a)
if c.most_common()[0][1] != 1:
	print('NO')
	return
print('YES')


N = int(input())
A_ls = input().split(' ')
A_set = {i for i in A_ls}
if len(A_set) == N:
	print('YES')
else:
	print('NO')


num = int(input())
lis = input().split()
print('YES' if len(set(lis)) == len(lis) else 'NO')


input()
l = list(map(int, input().split()))
print('YNEOS'[len(l) != len(set(l))::2])


input()
(*a,) = map(int, input().split())
print(['NO', 'YES'][len(a) == len(set(a))])


N = int(input())
A = list(map(int, input().split()))
print('YNEOS'[not len(A) == len(set(A))::2])


import sys
n = int(input())
a = dict()
for x in map(int, input().split()):
	if a.get(x) == 1:
		print('NO')
		return
	a[x] = 1
print('YES')


n = int(input())
S = list(map(int, input().split()))
S_set = set(S)
if len(S) == len(S_set):
	print('YES')
else:
	print('NO')


(n, *a) = map(int, open(0).read().split())
print('YNEOS'[len(set(a)) != len(a)::2])


N = int(input())
(*l,) = map(int, input().split())
print('YES' if len(l) == len(set(l)) else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
memo = 0
for i in range(n - 1):
	if b[i] == b[i + 1]:
		memo += 1
if memo == 0:
	print('YES')
else:
	print('NO')


N = int(input())
print('YES' if len(set([int(a) for a in input().split()])) == N else 'NO')


def resolve():
	n = int(input())
	a = tuple(map(int, input().split()))
	print('YES' if len(a) == len(set(a)) else 'NO')
resolve()


n = int(input())
t = input().split()
if len(set(t)) == n:
	print('YES')
else:
	print('NO')


n = int(input())
lst = [int(i) for i in input().split()]
if len(set(lst)) == n:
	print('YES')
else:
	print('NO')


def DuplicateCheck(seq):
	return len(seq) != len(set(seq))
N = input()
A = input().split()
print('NO' if DuplicateCheck(A) else 'YES')


n = int(input())
print('YNEOS'[len(set(map(int, input().split()))) != n::2])


N = int(input())
A = list(map(int, input().split()))
A.sort()
print('YNEOS'[any((a == b for (a, b) in zip(A, A[1:])))::2])


N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
	if a in dic:
		dic[a] += 1
	else:
		dic[a] = 1
M = max(dic.values())
print('YES' if M == 1 else 'NO')


N = int(input())
A = input().split()
A_set = set(A)
if len(A) == len(A_set):
	print('YES')
else:
	print('NO')


n = int(input())
AS = set(list(input().split()))
print('YES' if len(AS) == n else 'NO')


N = int(input())
A = sorted(list(map(int, input().split())))
l = []
for i in range(N - 1):
	l.append(A[i + 1] - A[i])
if 0 in l:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
a.sort()
before = a[0]
for i in range(1, n):
	if before == a[i]:
		print('NO')
		break
	before = a[i]
else:
	print('YES')


n = int(input())
an = list(map(int, input().split()))
an.sort()
for x in range(n - 1):
	if an[x + 1] - an[x] == 0:
		print('NO')
		break
else:
	print('YES')


def main():
	n = int(input())
	l = [int(v) for v in input().split()]
	if len(set(l)) == n:
		return 'YES'
	return 'NO'

def __starting_point():
	print(main())
__starting_point()


N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 'YES'
for i in range(1, N):
	if A[i - 1] == A[i]:
		ans = 'NO'
		break
print(ans)


n = int(input())
a = [int(s) for s in input().split()]
print('YES') if len(a) == len(set(a)) else print('NO')


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
n = N()
a = L()
s = set()
for i in range(n):
	if a[i] in s:
		print('NO')
		return
	s.add(a[i])
print('YES')


n = int(input())
lst = input().split()
if len(set(lst)) == n:
	print('YES')
else:
	print('NO')


n = int(input())
A = list(map(int, input().split()))
r = len(set(A))
print('YES' if n == r else 'NO')


print('YNEOS'[int(input()) != len(set(input().split()))::2])


N = int(input())
A = list(map(int, input().split()))
dic = {}
for num in A:
	if num not in dic:
		dic[num] = 1
	else:
		dic[num] += 1
if max(dic.values()) > 1:
	print('NO')
else:
	print('YES')


N = int(input())
Alist = list(map(int, input().split()))
temp = len(Alist)
ansnum = len(list(set(Alist)))
if ansnum == temp:
	print('YES')
else:
	print('NO')


n = int(input())
a_list = input().split()
if len(a_list) == len(set(a_list)):
	print('YES')
else:
	print('NO')


input()
a = [*map(int, input().split())]
print('YNEOS'[len(set(a)) != len(a)::2])


input()
list = input().split()
print('NO' if len(list) != len(set(list)) else 'YES')


(_, a) = open(0)
(*a,) = map(int, a.split())
print('YES' if len(a) == len(set(a)) else 'NO')


n = int(input())
print('NYOE S'[len(set(map(int, input().split()))) == n::2])


_ = input()
a = input().split()
print(['YES', 'NO'][len(a) != len(set(a))])


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(n - 1):
	if l[i] == l[i + 1]:
		print('NO')
		return
print('YES')


(_, *a) = open(0).read().split()
print('YNEOS'[len(a) != len({*a})::2])


input()
a = list(map(int, input().split()))
print('NYOE S'[len(a) == len(set(a))::2])


A = int(input())
a = set(map(int, input().split()))
print('YES' if A == len(a) else 'NO')


n = int(input())
v = set(input().split())
print('YNEOS'[len(v) < n::2])


N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
for i in range(N - 1):
	if A[i] == A[i + 1]:
		print('NO')
		return
print('YES')


N = int(input().strip())
print('YES' if len(set(input().strip().split())) == N else 'NO')


(_, *a) = open(0).read().split()
print('YNEOS'[sorted(a) != sorted(set(a))::2])


input()
A = list(map(int, input().split()))
print('YNEOS'[len(A) > len(set(A))::2])


n = int(input())
a_n = sorted(input().split())
print('YES' if len(set(a_n)) == n else 'NO')


import collections
n = int(input())
aa = list(map(int, input().split()))
c = collections.Counter(aa)
if len(c) == n:
	print('YES')
else:
	print('NO')


n = int(input())
A = list(map(int, input().split()))
A.sort()
success = True
for i in range(n - 1):
	if A[i] == A[i + 1]:
		success = False
		break
if success:
	print('YES')
else:
	print('NO')


N = int(input())
A = set(input().split())
print('YNEOS'[len(A) != N::2])


n = int(input())
m = len(set(input().split()))
print(['NO', 'YES'][n == m])


n = int(input())
A = set(input().split())
print('YES' if len(A) == n else 'NO')


n = int(input())
arr = input().split()
print('YES' if len(arr) == len(set(arr)) else 'NO')


(n, a) = open(0)
print('YNEOS'[int(n) > len(set(a.split()))::2])


print(['YES', 'NO'][int(input()) != len(set(input().split()))])


n = int(input())
lst = list(map(int, input().split()))
x = len(lst)
lst = list(set(lst))
y = len(lst)
if x == y:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
c = []
res = 'YES'
for i in range(n):
	c.append(a[i])
c = set(c)
if len(c) != n:
	res = 'NO'
print(res)


N = int(input())
A = input().split()
ans = 'YES' if len(A) - len(set(A)) == 0 else 'NO'
print(ans)


N = int(input())
A = list(map(int, input().split()))
s = set()
for i in range(N):
	s.add(A[i])
if len(s) == N:
	print('YES')
else:
	print('NO')


(_, a) = open(0)
print('NYOE S'[eval('!='.join(sorted(a.split())))::2])


num = int(input())
print('YES' if len(set([int(i) for i in input().split()])) == num else 'NO')


from collections import Counter
cnt = input()
num_list = Counter(map(int, input().split()))
for _ in num_list.values():
	if _ > 1:
		print('NO')
		break
else:
	print('YES')


import copy
N = int(input())
list1 = list(map(int, input().split()))
list2 = copy.copy(list1)
list3 = set(list1)
x = len(list2)
y = len(list3)
if x == y:
	print('YES')
else:
	print('NO')


N = int(input())
ls = input().split(' ')
dic = {i for i in ls}
if len(dic) == N:
	print('YES')
else:
	print('NO')


n = int(input())
nums = input().split(' ')
nums = [int(x) for x in nums]
s = set()
b = False
for x in nums:
	if x in s:
		print('NO')
		b = True
		break
	s.add(x)
if not b:
	print('YES')


n = input()
l = list(input().split())
print('YES' if len(l) == len(set(l)) else 'NO')


(n, *a) = map(int, open(0).read().split())
print('NYOE S'[len(set(a)) == n::2])


input()
x = input().split(' ')
if len(x) == len(set(x)):
	print('YES')
else:
	print('NO')


n = int(input())
s = list(map(int, input().split()))
temp = len(s)
ans = len(list(set(s)))
if temp == ans:
	print('YES')
else:
	print('NO')


input()
a = input().split()
if len(a) == len(set(a)):
	print('YES')
else:
	print('NO')


N = int(input())
S = input().split()
if N == len(set(S)):
	print('YES')
else:
	print('NO')


input()
a = [i for i in input().split()]
print('YES' if len(a) == len(set(a)) else 'NO')


_ = input()
l = [int(x) for x in input().split()]
l.sort()
for i in range(len(l) - 1):
	if l[i] == l[i + 1]:
		print('NO')
		return
print('YES')


n = int(input())
A = list(map(int, input().split()))
res = set()
ans = 'YES'
for i in range(n):
	if A[i] in res:
		ans = 'NO'
		break
	res.add(A[i])
print(ans)