Harumachi Kaze
시간 제한90초메모리 제한2048 MB
숨겨진 순열 아래에서 add와 cmp 질의만으로 두 배열 누적합을 합친 k번째 값을 찾고, 배열 원소 갱신까지 처리한다.
문제
This is an interactive problem.
You are given two arrays and of length , consisting of non-negative integers.
There is a hidden permutation of integers from to : . You only know that .
Since is a permutation, can also be defined: when .
Also, you are given an integer . A positive integer is called cute if and only if the two following conditions hold:
- The binary representation of , when viewed as a string of length , is a palindrome.
- If a bit in the binary representation of is , this bit must either be in the first bits or in the last bits. For example, if , the two bits in the center must both be .
You have to support queries of two types.
The first type of query is to change an element in one of the arrays.
The second type of query is to answer the following question: if we list integers, , , , and , , , , and sort them into , what would be? It is guaranteed that is a cute number.
There are two interaction functions for you to call.
- : returns .
- : returns .
Please beware that it is invalid to ask if .
To help you refrain from making invalid calls, it is guaranteed that, at any moment, the following condition holds: .
입력
You begin the interaction by reading three integers: , , (; ; ).
Then, you should read two lines, the first containing the array (), and the second containing the array ().
After that, you should read the contents of the queries.
For the next lines, the first integer indicates the type of query ().
-
If , three integers follow: , , (; ; ).
- If , set .
- If , set .
-
If , one integer follows (). It is guaranteed that is a cute number.
It is guaranteed that there is at least and at most queries of type .