I'm getting Wrong Answer, but my output is correct for all the test cases I've found on the board. I can't think of any corner cases where my program will fail. Any suggestions?
Search found 3 matches
Search found 3 matches • Page 1 of 1
Aha, I hadn't thought of that. I'll try this.mf wrote:Input may contain repeated values of k, and if your code recomputes output every time then it'll easily time-out. (Just imagine a file with, say, a thousand of 13's).
Actually there is a way to solve this problem without precalculation! Here's how I've solved it, but I'm too lazy to re-derive my solution now. The code solves the case k=13 in less than a second. <snip> My solution is very similar to this, although slightly more optimized (since it eliminates many...