`I am trying to solve https://mirror.codeforces.com/gym/103470/problem/K.
My solution is similar to the official tutorial(If you don't understand Chineses, it's ok! I write annotation in the code),but I'm troubled with constant factor(maybe not? If my time complexity is not good enough, please point out. qwq ), keeping getting TLE on test 38. :(
I wonder if someone can help me with it, pointing out something wrong with my implementations. qwq