i am just grinding a problem ( https://mirror.codeforces.com/contest/1991/problem/C ) and i found that this problem is bit different and how can someone came to this idea. is, this types of patterns repeats or it something else. bit confused...someone help
however maths theory is limited ,but idea is same in most problems,if you are good in maths mostly number theory then cp is easy for u else u would find cp difficult
Whenever a problem is with numbers, but the order of the numbers is not actually important,I think it is easy to look at them as points in a line. If you look at this problem that way, the operation just tells you the distance to that point. Then the 40 operations can give you a hint that it has to do something with O(logN). So if you are imagining the points in a line, you can think "maybe I can think of the points being in range [L,R]" and think how can you cut that range length in half.