Need Help in Debugging code for Lottery Money

, ,

Hello Coders,

There are 2 things that I want to ask regarding the problem asked in Innerve Summer Code Challenge T25 ( link: https://www.codechef.com/ISCC2018/problems/T25 ) :

  1. Can you anyone provide me with the test case I got wrong.Link to my submission is https://www.codechef.com/viewsolution/19321965
    Logic: i used two index i and j denoting starting and ending of the consecutive of cities jitendra can visit and see if cost is less than k then if number of cities greater than previous then make new max and new rem amount.

  2. Why did this guy not received WA(link: https://www.codechef.com/viewsolution/19340326 ).When i run his code it fails the given example also.

It would be great if i can find editorial for these problems. Thanks in advance.

Your logic is perfect. But, I don’t know why, you must spend the maximum possible money, if you can visit the same number of places for two different amounts, ie, the remaining money should be minimum.

ACed solution: https://www.codechef.com/viewsolution/19346328

remaining money should be max or min? You said we will spend min so remaining money should be max?

1 Like

Who wants to spend max money…I too got WA because of that

1 Like

@sarthakmanna Thanks a lot for looking at my code. but I also submitted one code similar to yours (link:https://www.codechef.com/viewsolution/19316934 ) it also got WA. Can you help me with that also?

OOPS!! I put wrong inequality there!! NOOOO… :frowning:

No i didn’t. Question was wrong!!!

It has a strange tie-breaking condition which isn’t mentioned in the question.

If there are multiple paths of the same number of cities, choose the path where you spend more money. :\

Here is my AC submission.

I Even asked them on the page but they did not reply.