Please can someone give the approach to this problem. thanks
Am I wrong or this problem is VERY similar to this? https://www.codechef.com/LTIME52/problems/CHEFTRAF
read about these things first.
now try reading and solving it.
the credit goes to swetankmodi : https://www.codechef.com/viewsolution/15587794