i have encountered similar uestion and stuck on that due to TLE
this is code -
link to uestion -
https://www.codechef.com/FUSN2020/problems/CKWR04
i have encountered similar uestion and stuck on that due to TLE
this is code -
link to uestion -
https://www.codechef.com/FUSN2020/problems/CKWR04
hello @officialharshit1996
there are advance datastructure and algorithms to solve such problems
a) fenwick tree
b) segment tree + lazy propagation
c) policy based datastructures
d) mo algorithm
e) prefix suffix technique.
f)dp
etc
learn them first to solve such problems
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.