| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 15 초 | 2048 MB | 0 | 0 | 0 | 0.000% |
You are given a sequence $a_1, \ldots, a_n$ and a permutation $b_1, \ldots, b_n$. Process $m$ operations of the following form:
The first line of input contains two integers $n$ and $m$ (1ドル \le n, m \le 10^6$).
The second line contains $n$ integers $a_1, \ldots, a_n$ (1ドル \le a_i \le n$).
The third line contains $n$ integers $b_1, \ldots, b_n$ (1ドル \le b_i \le n$; all $b_i$ are distinct).
Each of the next $m$ lines consists of integers and has either the form "1~$x$~$y$" for a modification operation or the form "2~$\ell$~$r$~$x$" for a query operation (1ドル \le x, y \le n$; 1ドル \le \ell \le r \le n$).
You may assume that there is at least one query operation.
For each query operation, output one line with the corresponding maximum length.
8 10 1 4 7 3 8 2 4 7 5 4 8 7 1 6 3 2 2 6 6 2 2 8 8 7 1 4 3 2 6 8 3 2 4 4 3 2 4 4 3 2 6 8 4 2 5 6 2 2 1 8 1 2 1 1 6
1 1 0 1 1 3 2 1 0