Neq Min

AtCoder
IDhhkb2020_c
Time2000ms
Memory256MB
Difficulty
Given is a number sequence of length $N$: $p_1, ..., p_N$. For each $i=1, 2, ..., N$, find the minimum non-negative integer that is not equal to any of the numbers $p_1, ..., p_i$. ## Constraints * $1 \leq N \leq 200,000$ * $0 \leq p_i \leq 200,000$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $p_1$ $...$ $p_N$ [samples]
Samples
Input #1
4
1 1 0 2
Output #1
0
0
2
3

*   The minimum non-negative integer that is not equal to $p_1=1$ is $0$.
*   The minimum non-negative integer that is not equal to any of $p_1=1, p_2=1$ is $0$.
*   The minimum non-negative integer that is not equal to any of $p_1=1, p_2=1, p_3=0$ is $2$.
*   The minimum non-negative integer that is not equal to any of $p_1=1, p_2=1, p_3=0, p_4=2$ is $3$.
Input #2
10
5 4 3 2 1 0 7 7 6 6
Output #2
0
0
0
0
0
6
6
6
8
8
API Response (JSON)
{
  "problem": {
    "name": "Neq Min",
    "description": {
      "content": "Given is a number sequence of length $N$: $p_1, ..., p_N$. For each $i=1, 2, ..., N$, find the minimum non-negative integer that is not equal to any of the numbers $p_1, ..., p_i$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "hhkb2020_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given is a number sequence of length $N$: $p_1, ..., p_N$.\nFor each $i=1, 2, ..., N$, find the minimum non-negative integer that is not equal to any of the numbers $p_1, ..., p_i$.\n\n## Constraints\n\n* ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments