#K43902. Duplicate Checker
Duplicate Checker
Duplicate Checker
Given a list of \(n\) integers, determine whether the list contains any duplicate values. Formally, for a sequence \(a_1, a_2, \ldots, a_n\), check if there exist two distinct indices \(i\) and \(j\) such that \(a_i = a_j\). If a duplicate is found, output YES
; otherwise, output NO
.
For example, if \(n = 6\) and the list is [12, 34, -5, 12, 6, 7], since 12 appears more than once, the correct output is YES
.
inputFormat
The input is read from standard input and consists of two lines:
- The first line contains a single integer \(n\) (\(1 \leq n \leq 10^5\)), representing the number of elements in the list.
- The second line contains \(n\) space-separated integers, each representing an element of the list.
outputFormat
Output a single line containing YES
if the list has duplicate elements, or NO
if all elements are distinct.
6
12 34 -5 12 6 7
YES