Блог пользователя shadow_33

Автор shadow_33, история, 6 часов назад, По-английски

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>

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
6 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.
  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      5 часов назад, # ^ |
      Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

      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.

      • »
        »
        »
        »
        5 часов назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.