Simple enough(2 tle)

I AM NOT ABLE TO CRACK THE QUESTION CAN SOMEONE GIVE ME A HINT, HOW TO APPLY DIVIDE AND CONQUER??

problem:https://online.codingblocks.com/player/9713/content/5143?s=1811
unpotimised solution:https://ide.codingblocks.com/s/43462

Add the hackerblocks link,this link is shown to you guys only .

Hey Updesh, mention the exact problem name.

https://hack.codingblocks.com/contests/c/547/907

problem name:SIMPLE ENOUGH https://hack.codingblocks.com/contests/c/547/907

i am getting 2 tle how to remove them?

Answered under this thread. Please avoid raising separate threads for same problems.

If you know segment tree then it easy for you