5 4 3 3 1 4 5 2 1 3 2 5 5 1 3 3 2 2 4
1 0 2 Initially, $A = (3, 3, 1, 4, 5)$. For the first query, the second largest value in $(3, 3, 1)$ is $1$, which appears once in $3, 3, 1$, so print $1$. For the second query, there is no second largest value in $(5)$, so print $0$. The third query makes $A = (3, 3, 3, 4, 5)$. For the fourth query, the second largest value in $(3, 3, 4)$, is $3$, which appears twice in $3, 3, 4$, so print $2$.
1 1 1000000000 2 1 1
0
8 9 2 4 4 3 9 1 1 2 1 5 4 2 7 7 2 2 6 1 4 4 2 2 5 2 2 7 1 1 1 1 8 1 2 1 8
0 1 0 2 4
{
"problem": {
"name": "Second Largest Query",
"description": {
"content": "You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$. Process $Q$ queries in the order they are given. Each query is of one of the following two types: * Type $1$: Given in the form",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc343_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$.\nProcess $Q$ queries in the order they are given. Each query is of one of the following two types:\n\n* Type $1$: Given in the form...",
"is_translate": false,
"language": "English"
}
]
}