[Problem 22] Help in troubleshooting logic error

Back to General discussions forum

mike_braha     2018-02-06 02:21:22

We are struggling how to figure out what could be causing our wrong answer.

First, here is the expected answer: 234326420 296943650 7926192 206261442 1002400 420220578 35385076 435503980 287444448 315812370 94911294 356619744 292264578 120035784 14866212 105724725 509253063 212154117 104950093 173355689

Here is our answer: 234326420 296943650 7926192 206261440 1002400 420220578 35385076 435503978 287444448 315812365 94911294 356609734 292234924 120035784 14866212 105724725 509253063 209314320 104950093 173355689

We observe that, for many of the test cases, we yield the correct answer. For some of the wrong entries, we see we are off by a very small margin (for example, the 4th test case is only off by 2!) This tells us the logic of the algorithm is either correct, or extremely, ludicrously lucky, seeing we hit 14/20 cases. We want to assume the base logic is correct.

Our first thought is to step through the code state-machine style, but this won't reveal any new information. There doesn't seem to be anything unique with this test case (153 44 6035874), or any other failed test cases.

We will share the code if needed, but does anybody have any tips on how we can troubleshoot this bug?

Quandray     2018-02-06 07:28:46
User avatar

If you print 1348114 on the slow printer, it will take 206261442. Starting at the same time, if you print 4687760 on the quicker printer, it will take 206261440. So the overall time is 206261442. Does that help?

Please login and solve 5 problems to be able to post at forum