#K47727. Unique Element Array Checker
Unique Element Array Checker
Unique Element Array Checker
Given an array of integers, your task is to determine whether the array is a Unique Element Array. An array is considered a Unique Element Array if and only if every element appears exactly once.
You will be provided with a single test case through standard input. The first line contains a non-negative integer n, which denotes the number of elements in the array. The second line contains n space-separated integers representing the array. If n = 0, the array is empty and should be considered unique.
Your output should be printed to standard output as a single string: print Unique!! if the array is unique, and NOT!! otherwise.
The problem can be formally expressed with the following condition:
Let \( A = [a_1, a_2, \dots, a_n] \). The array is unique if and only if \( |\{a_1, a_2, \dots, a_n\}| = n \).
inputFormat
The input is given via stdin and consists of:
- The first line contains an integer n (\( n \geq 0 \)), the number of elements in the array.
- The second line contains n space-separated integers.
If n = 0, the second line may be omitted.
outputFormat
Output a single line to stdout. The line must contain one of the following strings:
- Unique!! if every element in the array appears exactly once.
- NOT!! otherwise.
5
1 2 3 4 5
Unique!!