Account
Draft saved on this device
▤ DescriptionOriginal CppValley problem
Core C++Easy

Find The First Duplicate Identifier

Scan N integers from left to right.

Scan N integers from left to right. Print the value of the first element that has appeared earlier. If every element is unique, print NONE. The first duplicate is determined by the position of its second occurrence, not by numeric value.

Input format

First line N; next N signed integers.

Output format

Print the duplicated integer or NONE.

Examples

Example 1
Input
6
4 8 1 8 4 1
Expected output
8

Constraints

  • 0 ≤ N ≤ 100000
  • -10^9 ≤ values ≤ 10^9

Related concepts

Hashing

This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.

⌘ CodeC++17
GNU C++17 · main.cpp

Loading Monaco C++ editor…

Checking judge...

Checking whether the external C++ judge is available.

⌁ Test cases & resultsPublic samples: 1
Input
6
4 8 1 8 4 1
Expected output
8
Execution requires a secure external judge.