MianKing has a sequence a1...na_{1...n}a1...n and he wants to answer QQQ queries about it. Let fff denote the K-th smallest number of sequence b1...nb_{1...n}b1...n which satisfies that i∈[1,n],bi=aixorSforall i in [1,n], b_i=a_i~xor~Si∈[1,n],bi=aixorS. Now for each query, give you L,R,KL,R,KL,R,K, you need to answer MinS=LRfMin_{S=L}^{R}fMinS=LRf.
MianKing has a sequence a1...na_{1...n}a1...n and he wants to answer QQQ queries about it. Let f(a,S,K)f(a,S,K)f(a,S,K) denote the K-th smallest number of sequence b1...nb_{1...n}b1...n which satisfies that ∀i∈[1,n],bi=ai xor Sforall i in [1,n], b_i=a_i~xor~S∀i∈[1,n],bi=ai xor S. Now for each query, give you L,R,KL,R,KL,R,K, you need to answer MinS=LRf(a,S,K)Min_{S=L}^{R}f(a,S,K)MinS=LRf(a,S,K).

(图片来源网络,侵删)