I’m practicing for ACM ICPC and I came on this problem from 2017 ACM ICPC Arab Regionals:
https://icpcarchive.ecs.baylor.edu/external/84/8457.pdf
I am already stuck on it for two days and I really don’t have idea how approach it. I couldn’t find editorial anywhere.
Can somebody please tell me how to solve it? Big thanks in advance.