King Richard's Knights

  • + 1 comment

    I bought the test case #3 to look at the input... It's a file bigger than 8 MB. How should it be possible to read in the input, compute and put out the resut in less than 4 seconds? I tried to optimize it, but it's still O(n^2) running time... The only correct test is #1, all the others are out of time. I'm a beginner, what could I do to do it better?