#P5397. [Ynoi2018] 天降之物

[Ynoi2018] 天降之物

Description

Icarus gives you a sequence aa of length nn.

You need to process mm operations. There are two types of operations:

  1. Change the value of every element equal to xx in the sequence to yy.
  2. Find a position ii such that ai=xa_i=x and a position jj such that aj=ya_j=y, so that ij|i-j| is minimized, and output ij|i-j|.

Input Format

The first line contains two integers n,mn,m.

The next line contains nn integers, representing the sequence aa.

Then follow mm lines, each containing three numbers opt,x,yopt,x,y.

If optopt is 11, it means changing the value at every position with value xx to yy.

If optopt is 22, it means finding a position ii such that ai=xa_i=x and a position jj such that aj=ya_j=y to minimize ij|i-j|, and output ij|i-j|. If no such positions can be found, output Ikaros.

This problem is strictly online. For each operation, x,yx,y need to be xor-ed with the answer from two queries ago. If the output is Ikaros, or if it is the first query, then the last answer is 00.

There are 5050 test cases in total, and it is guaranteed that n=mn=m.

Output Format

For each operation of type 22, output one line with an integer representing the answer.

If it is impossible to find i,ji,j that satisfy the statement, output Ikaros.

5 5
1 2 2 4 4
2 3 3
2 2 4
1 3 2
1 5 5
2 2 5

Ikaros
1
1

Hint

Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477 ( partially uploaded ).

Constraints: For 100%100\% of the testdata, all numbers are within [1,105][1,10^5], and the value in each operation does not exceed nn.

Translated by ChatGPT 5