shadow_33's blog

By shadow_33, history, 2 hours ago, In English

Hi everyone could someone give me some tips to how to know the test cases that may make my code give me wrong answers and how can I test my code and guess the main test cases in the problem and if my code give me wrong answer how can I guess the test case that is wrong because I struggle too much when I get Wrong answer ?? and Thanks in advance>

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by shadow_33 (previous revision, new revision, compare).

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by shadow_33 (previous revision, new revision, compare).

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Here is what I usually do.

  • Write a very naive and simple solution (maybe exponential complexity) that would exceed the time limit but is otherwise correct. If it is after the contest, you can also just use someone else's solution.
  • Write a program to generate thousands (!) of small (!) test cases.
  • You can then run both programs on the generated test cases to find a test case where the two disagree.
  • »
    »
    2 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    wtf we basically said the same thing. does this mean I will get red one day?

    • »
      »
      »
      105 minutes ago, # ^ |
      Rev. 2   Vote: I like it +1 Vote: I do not like it

      Your coincidence is only once so the chance of you reaching red $$$ = \frac{1}{\text{number of your comments on cf}}$$$ which I think is pretty low.

      • »
        »
        »
        »
        96 minutes ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        oops idk why it is not displaying but just imagine the image of sad chud with "its over" text above

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Usually, the brute force solutions to these problems are easy to write if you know recursive backtracking, so just write a brute force solution and generate a bunch of random testcases and find one that makes your original code produce a different answer.