Simple Queries

Limits 4s, 512 MB

You are given an array x of distinct integers  x1,x2,x3…xn(0≤xi≤109;1≤i≤n)x_{1}, x_{2}, x_{3}… x_{n} (0 ≤ x_{i} ≤ 10^9 ; 1 ≤ i ≤ n)x1​,x2​,x3​…xn​(0≤xi​≤109;1≤i≤n) of length n. Now you have to execute q queries of two types of the following form:

This is a companion discussion topic for the original entry at