code_fille's blog

By code_fille, 10 years ago, In English

Link to problem:- http://www.codechef.com/problems/SUBARRAY

Link to solution:- http://www.codechef.com/viewsolution/7071035 Can anyone tell me the testcase my code gives wrong output for.

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I have an excellent advice. Write stress test for your solution. Just make solution in O(n2) or O(n3) (it is not important, the simpler the better solution) and ran it against yours for many small random test cases.))) This approach is better than asking people to understand your code.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It seems that it's a good advice for checking TLE problems using generation of big random input tests. But when the problem is wrong answer — how to obtain expected result for every input?

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      write another solution (brute force) that works for small test cases.