GQR LunchTime

codechef lunchtime gqr

Question Link:

Answer Link:

My code will run for first two subtask, but not for the third as array size is becoming too large.

I have checked the test cases, the code should follow the first 2 subtask. But still it is showing TLE. WHY...???????

Samrat De

Please Log in to answer

Note: Your answer should not be too short. Please wait a few seconds for the editor to load

Please make sure the answer is not too short

1 Answer

preda2or 00:39, Apr 02
Shubham Kumar Gupta

for first subtask: an array element can be as high as pow(10,8).Won't even pass one query.

Try this test case :

4 1
4 2 100000000 8
2 3

for second subtask:

  • 1 ≤ N ≤ 10^4
  • 1 ≤ Q ≤ 5 · 10^5

your code complexity is way beyond N*Q even in average case.

Please make sure the answer is not too short
No Comments yet