}else{returnval[pos]; } }intmain(){ scanf("%d", &T);while(T--){ memset(vis,false,sizeof(vis)); scanf("%d", &n);inta, b; a=get(1);intl =1, r =n, ans;while(l <=r){intm = (l + r) >>1;intc =get(m);if(c == a) ans =m;if(c != a) r = m -1;elsel...
Iftype= 1, you are asking the judge a query for the value of the element of the array at indexval. After printing this line, the judge will print to the standard input a line containing one integer corresponding to the value of the element at indexval. Iftype= 2, you are telling th...
There is an array of length N consisting of non-negative integers. The array is sorted in non-decreasing order. Each number in the array appears exactly K times, except one element, which appears at least once, but less than K times. Your task is to identify that element. This is an ...
You are given an array A of N integers. Create another array B containing all or-subarrays of A . i.e B containsAl|Al+1|...ArAl|Al+1|...Arfor all1<=l<=r<=N1<=l<=r<=N You are provided Q queries . n each query you have to print K-th smallest element of B. 1<=Ai<...