Need Help — How to solve [4674 — Post offices] [Live Archive] ?
Problem Link: Here
Any hints will be appreciated.
I thought about DP but I couldn't know how to manage it.
Thanks
Codeforces Round 946 Solution Discussion