Tamaami's blog

By Tamaami, history, 4 years ago, In English

If i am getting a WA verdict on pretest what are the techniques I need to follow

If I know the logic of how to solve the question but due to code error

if i'm getting WA verdict are there any general techniques followed to find out the error correctly.

PLease share your techniques with me.

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

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Try to find a test case using Random test cases

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it
  • Write a very naive and simple solution to the problem (maybe exponential complexity) (if you can, you may also just copy someone else's solution)
  • Write a program to generate thousands of small (!) test cases
  • Using those two, find a test case where your program gives the wrong answer
  • Use print statements or a debugger to see where exactly your program does the wrong thing.