B - Mex
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
長さ の整数からなる数列 が与えられます。
に含まれない最小の非負整数を求めてください。
制約
- 入力は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
Copy
8 0 3 2 6 2 1 0 0
出力例 1Copy
Copy
4
非負整数は と続きます。
は に含まれ、 は に含まれないので、答えは です。
入力例 2Copy
Copy
3 2000 2000 2000
出力例 2Copy
Copy
0
Score : points
Problem Statement
You are given a sequence of length consisting of integers: .
Find the smallest non-negative integer not in .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
Copy
8 0 3 2 6 2 1 0 0
Sample Output 1Copy
Copy
4
The non-negative integers are .
We have in , but not , so the answer is .
Sample Input 2Copy
Copy
3 2000 2000 2000
Sample Output 2Copy
Copy
0