Complex Operations

You are given an array A of length N. You have to perform two different types of operations. In the …

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

n,q=map(int,input().split())
array=list(map(int,input().split()))
for i in range(q):
	f=list(map(int,input().split()))
	if f[0]==1:
		array=list(map(lambda x:x-f[1],array))
	else:
		if f[2]-f[1]<f[3] :
			print(-1)
		else:
			k=array[f[1]:f[2]+1]
			k.sort()
			
			print(k[f[3]])

I am getting run time in the second test case however, i was expecting CLE since i did not use Binary search. @hjr265 @Bishal_G Could you please check? i copy pasted my code so the identation got messed up here.