firedrakesin's blog

By firedrakesin, history, 5 years ago, In English

https://codeforces.me/contest/1574/submission/129708228 whats wrong with this code can't know the edge case so, not able to know what is wrong.

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

| Write comment?
»
5 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

The test case is 1 4 4 3

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

    How did you know .. that's wow.... Thank You

    • »
      »
      »
      5 years ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

      Method to find such counterexamples:

      • 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