I was doing this problem from Atcoder : https://atcoder.jp/contests/abc128/tasks/abc128_c
Can someone please explain the solution?
I have seen the editorial but couldn’t understand it.
Solution link: https://atcoder.jp/contests/abc128/submissions/15518338 (Python)
Solution link: https://atcoder.jp/contests/abc128/submissions/5640467 (C++)