firedrakesin's blog

By firedrakesin, history, 5 weeks ago, In English

https://codeforces.cc/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

»
5 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

The test case is 1 4 4 3

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

    ok

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

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

    • »
      »
      »
      5 weeks ago, # ^ |
        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