improvement_19's blog

By improvement_19, history, 3 years ago, In English

https://codeforces.com/contest/1485/submission/118904427 i have tried a lot still dont get my mistake please help ,why it is wrong ans in which type of test cases it will not work

  • Vote: I like it
  • +1
  • Vote: I do not like it

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

Try

  • $$$l = 1$$$, $$$r = n$$$
  • $$$l = r = 1$$$
  • $$$l = r = n$$$
»
3 years ago, # |
  Vote: I like it -16 Vote: I do not like it

Have you tried the following:

  • 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.

98% of WAs and REs can be resolved this way. People here don't have the time to delve into every code posted here, it's much harder to debug somebody else's code and being able to debug your own code is a valuable skill. It is also a very routine process that can be learned much faster than problem solving and algorithms.

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Bonus fact: test $$$5$$$ was initially in the pretests, then I decided to remove it to avoid the queue :(

Because of this, pretests were weak and $$$20\%$$$ of the solutions of this problem failed on system tests.