| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 24 | 13 | 12 | 52.174% |
JOI-kun, an algorithm researcher, has developed a machine called the Bubble Sort Machine.
The Bubble Sort Machine operates on an integer sequence $a = (a_1, a_2, \dots , a_N)$ of length $N$. To activate the Bubble Sort Machine, the initial values $A_i$ are provided as input for each $a_i$ (1ドル ≤ i ≤ N$). Each time Button 1 on the Bubble Sort Machine is pressed, the machine modifies the sequence $a$ in the following way:
To make the Bubble Sort Machine even more appealing, JOI-kun decided to add the following feature:
Given the initial values of the integer sequence and the sequence of operations on the Bubble Sort Machine, write a program that computes the outputs produced by Button 2.
Read the following data from the standard input.
$N$
$A_1$ $A_2$ $\cdots$ $A_N$
$Q$
(Query 1ドル$)
(Query 2ドル$)
$\vdots$
(Query $Q$)
Here, $Q$ is the number of operations performed on the Bubble Sort Machine. Each (Query $j$) (1ドル ≤ j ≤ Q$) consists space separated integers. Let $T_j$ denote the first integer of (Query $j$). The content of this line is one of the following.
For each operation where Button 2 is pressed, that is, for each $j$ (1ドル ≤ j ≤ Q$) such that $T_j = 2,ドル output the integer produced by the Bubble Sort Machine on a separate line in the order of the queries.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 5 | The number of $j$ (1ドル ≤ j ≤ Q$) such that $T_j = 1$ is at most 10ドル$. |
| 2 | 11 | $N ≤ 150,円 000,ドル $Q ≤ 150,円 000,ドル $L_j = R_j = 1$ if $T_j = 2$ (1ドル ≤ j ≤ Q$). |
| 3 | 15 | $N ≤ 150,円 000,ドル $Q ≤ 150,円 000,ドル 1ドル ≤ A_i ≤ 2$ (1ドル ≤ i ≤ N$). |
| 4 | 23 | $N ≤ 150,円 000,ドル $Q ≤ 150,円 000,ドル $L_j = R_j$ if $T_j = 2$ (1ドル ≤ j ≤ Q$). |
| 5 | 29 | $N ≤ 150,円 000,ドル $Q ≤ 150,円 000$. |
| 6 | 17 | No additional constraints. |
4 5 3 5 2 6 2 1 3 1 2 1 1 2 2 4 1 2 1 2
13 3 12 5
First, the initial values $a_1 = 5,ドル $a_2 = 3,ドル $a_3 = 5,ドル and $a_4 = 2$ are given, initializing $a = (5, 3, 5, 2)$. The operations of the Bubble Sort Machine proceed as follows:
This sample input satisfies the constraints of subtasks 1, 5, and 6.
5 1 1 2 1 2 5 2 2 3 1 2 2 4 1 2 2 4
3 4 4
This sample input satisfies the constraints of subtasks 1, 3, 5, and 6.