enter image description here
this image describes the question from kattis I was about to solve. Give me some ideas that I could employ while doing it.
I am just s