Project Euler #190: Maximising a weighted product

  • + 2 comments

    I am stuck at 38/100. Two tests keep timing out. The unsuccessful test cases switch around between "wrong answer" and "runtime error", depending on my various attempts to optimize.

    My correct test cases seem to finish fast (around 0.2s), while the wrong ones seem slower (around 7s). This could point to some error when the calculations involve more steps.

    I am starting to suspect that the recognition of runtime errors is not working correctly. So the wrong answers might be actually resource exhaustions.

    Some results for comparison:

    X A m -> sum Q (mod 10^9+7)
    6 4 2 -> 375000357
    6 5 2 -> 214721813
    6 6 2 -> 9027
    7 5 3 -> 886720700
    7 6 3 -> 834194410
    7 7 3 -> 19002