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



Sample input:
5
2 6 1 4 5


Sample output:
YES

Submission status: Runtime Error

Solution code:
def check_all_distinct(A):
  already_seen_chars = list()
  for character in A:
    if character not in already_seen_chars:
      already_seen_chars.append(character)
      print(already_seen_chars)
    else: return "NO"
  return "YES"


if __name__ == "__main__":
  N = int(input())
  A = input().split()
  print(check_all_distinct(A))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main(){
  int N;
  cin >> N;
  int memo=0;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A,A+N);
  for(int i=1;i<N;i++){
    if(A[i]==A[i-1]){
      memo = 1;
    }
  }
  if(memo == 1) cout <<"NO";
  else cout << "YES";
}

Submission status: Runtime Error

Solution code:
num = int(input())
str_list = input.split(" ")

yes = True
 
for index, s in enumerate(str_list):
	if s in str_list[:index]:
		yes = False
		break
if yes:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

Solution code:
n = int(input())
a = map(int, input().split())
b = len(a)
c = len(set(a))
if b == c:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
num = int(input())
str_list = input.split(" ")

yes = True
 
for index, s in enumerate(str_list):
	if s in str_list[:index]:
    	yes = False
		break
if yes:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
f = 0
A.sort()
for i in range(len(A)):
    if A[i] == A[i+1]:
        f = 1
        break
        
if f > 0:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
num = int(input())
str_list = input.split(" ")

yes = True

for index, s in enumerate(str_list):
	if s in str_list[:index]:
    	yes = False
   		break
if yes:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

Solution code:
n =int(input())
a = [int(i) for i in input().split()]
is_same = False

for i in range(n):
    for j in range(i+1, n+1):
        if a[i] == a[j]:
            is_same = True

if is_same:
    print('NO')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split(' ')))

answer = 'YES'
max_val = max(A) + 1
check = [False] * max_val
for a in A:
    if check[a] == True:
        answer = 'NO'
        break
    else:
        check[a] = True
print(answer)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
f = 0
A.sort()
for i in range(len(A)):
    # if A.count(i) > 1:
    if A[i] == A[i+1]:
        f = 1
        break
        
if f > 0:
    print("NO")
else:
 print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
A_list = list(map(int, input().split()))

B = {}
for i in A_list:
  B.add(i)

if len(B) == N:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i,a in enumerate(A):
    if a in A[i+1:]
        print("NO")
        sys.exit(0)
print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
aa = map(int, input().split())
if len(set(aa)) != N:
  print('NO')
else:
  print('YES)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}
 
map<ll,ll> prime_factor(ll n){
    map<ll,ll> mp;
    for(ll i=2; i*i<=n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n != 1) mp[n] = 1;
    return mp;
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll s;
    cin >> s;
    ll x[s];
    for (ll i=0;i<s;i++){
        cin >> x[i];
        for (ll j=0;j<=i;j++){
            if (x[i]==x[j]){
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map, int(input().split()))
yn = ["YES","NO"]
flag = 0
for i in range(n-1):
  for j in range(i+1, n):
    if i == j: 
      flag = 1
print(yn[flag])

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split(' ')))
bucket = [0]*1000000001

distinct = True
for i in a:
    if bucket[i] != 0:
        distinct = False
        break
    bucket[i] += 1
    
if distinct:
    print("Yes")
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
A = map(int, input().split())
flag=0

for i in range(N): 
        for i1 in range(N): 
            if i != i1: 
                if A[i] == A[i1]: 
                    break
                else:
                  flag+=1

if flag>0:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
num = int(input())
str_list = input.split(" ")
 
num_dict = {}
yes = True
for s in str_list:
  if s in num_dict:
    yes = False
    break
  else:
    num_dict[s] = 1
if yes:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
N = int(input())
A = [input().split() for i in range(N)]
dup = [j for j in set(A) if A.count(j) > 1]
if dup == True:
  print("NO")
else:
  print("YES")

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
A = list(map(int,input().split()))

X = np.zeros(10**9, dtype = int)
flg = 'YES'
for a in A:
    if X[a]==1:
        flg = 'NO'
        break
    else:
        X[a] += 1
print(flg)

Submission status: Runtime Error

Solution code:
args0 = input()
args = input().split()

a=len(args)
if len(set(args))) == a:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(input().split() for i in range(N))]
dup = [j for j in set(A) if A.count(j) > 1]
if dup == True:
  print("NO")
else:
  print("YES")

Submission status: Runtime Error

Solution code:
N=int(input())
li = list(map(int,input().split()))	
num = {}
for l in li:
    print(num)
    if str(l) not in num  :
        num[l] = 1
    else:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
N,A=int(input()),list(map(int,input().split()))
A=sorted(A,key=int)
l=[0]*(A[-1]+1)
for i in A:
    if l[i]==1:
        print("NO")
        exit()
    else:
        l[i]=1
print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split(' ')))

answer = 'YES'
check = [False] * max(A)
for a in A:
    if check[a-1] == True:
        answer = 'NO'
        break
    else:
        check[a-1] = True
print(answer)

Submission status: Runtime Error

Solution code:
i=int(input())
x=[]
for i in range(0,i):
  a=int(input())
  if a in x:
    c=0
    break
  else:
    c=1
if(c==0):
  print("NO")
else: 
  print("YES")

Submission status: Runtime Error

Solution code:
num = int(input())
str_list = input.split(" ")

num_dict = {}
for s in str_list:
  if s in num_dict:
    print("NO")
    return
  else:
    num_dict[s] = 1
print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))

l = [0]*(10**9+10)
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))

b = [0] * max(a)
d = 'YES'

for i in range(n):
  b[a[i]-1] += 1

if max(b) > 1:
  d = 'NO'

print(d)

Submission status: Runtime Error

Solution code:
import sys
a=int(input())
b=list(map(int,input().split()))
c=[]
for i in range(a):
  c+=b[i]
  for i in range(len(c)):
    if b[i]==c[i]:
      print('NO')
      sys.exit()
print('YES')

Submission status: Runtime Error

Solution code:
N = int(input())
A_line = map(int, input().split())

A_flags = [0] * pow(10, 8)

for A in A_line:
  A_flags[A-1] += 1

res = 'YES'
for A_flag in A_flags:
  if A_flag >= 2:
    res = 'NO'

print(res)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    is_break = False
    seen = []
    for a in A:
        if a not in seen:
            seen.append(a)
        else:
            is_break = True
            break:
    
    if is_break:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
m = list(map(int,input().split()))
m.sort()
for i in range(n):
  if m[i] == m[i+1]:
    print('NO')
    exit()
    
print('YES')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys

N = int(input())
A = [int(i) for i in input().split()]

dp = [0] * max(A)

for a in A:
    if dp[a-1] != 0:
        print('NO')
        break
    dp[a-1] = 1
else:
    print('YES')

Submission status: Runtime Error

Solution code:
N=int(input())
li = list(map(int,input().split()))	
num = [0]*100000000
for l in li:
    if num[l] == 0:
        num[l] = 1
    elif num[l] == 1:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
#154 c
n=int(input())
a=list(map(int,input().split()))
num=dict()
flag=True
for x in a:
    if x not in num:
        a[x]=1
    else:
        flag=False
    if flag==False:
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop
from math import gcd as gcd_base

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

    for x, y in list(combinations(A, 2)):
        if x == y:
            print("NO")
            sys.exit()

    print("YES")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
a = input().split(" ")
b = set(a)
print "YES" if len(b) > len(a) else "NO"

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
if bool:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

List.sort()

for i in range(N-1):
    if List[i] == List[i+1]:
        result = 'NO'
        break
        
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
A_ = {}

for a in A:
  if a not in A_:
    A_[a] = 1
  else:    
    A[a] += 1
    break
if len(A) == len(A_):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(input().split())
a = len(collections.Counter(A))
n = len(A)

if (a == n):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
print(A)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def has_duplicates(seq):
    return len(seq) != len(set(seq))


if gcd_list(A)==1 and has_duplicates(A) == False:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
print('YES' if bool else 'NO')

Submission status: Runtime Error

Solution code:
N = int(input())
A_list = []

for i in range(N):
  A_list.append(int(input()))
  
len_org = len(A_list)
len_uniq = len(list(set(A_list)))

if len_org == len_uniq:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
from collections import Counter

n=int(input())

arr=list(map(int,input().split()))

cc=Counter(arr)
for k,v in cc.items():
  if v>1:
    print("NO")
    break
else:
print("NO")

Submission status: Runtime Error

Solution code:
    print("NO")

Submission status: Runtime Error

Solution code:
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
N=int(input())
A  = list(map(int,input().split()))

# print(A)
dictA={}

for i in A:
    if i in dictA: 
        print("NO")
        exit(0)
    dictA[i]=1
print("YES"
)
[myoden@ubuntu002 C]$ cat testC.py  ;echo 
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
N=int(input())
A  = list(map(int,input().split()))

# print(A)
dictA={}

for i in A:
    if i in dictA: 
        print("NO")
        exit(0)
    dictA[i]=1
print("YES")

Submission status: Runtime Error

Solution code:
#C
import numpy as np
n = int(input())
a = list(map(int, input().strip().split()))
b = np.zeros((10**9+9))
for i in range(n):
    if b[a[i]] == 0:
        b[a[i]] += 1
    else:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(x) for x in input().split]
for i in A:
    for j in A:
        if i == j:
            print('NO')
        else:
            print('YES')

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
S = list(set(A))
if len(A) == len(S):
  return "YES"
else:
  return "NO"

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
cnt = [0]* (max(A)+1)
for i in range(N):
    if cnt[A[i]] == 0:
        cnt[A[i]] = 1
    else:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
2
10000000 10000000