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

Автор Manoj07, история, 3 года назад, По-английски

Hello, Codeforces community

I need your advice on how to get the logic from the code. Since most of the time, we first given the logic and then introduced it to the code. But here, many times, I face issues on understanding editorials; hence try to do a dry run of the code either from successful submissions or from the editorial. But some codes use such a large number that I can't do a dry run. Hence, seeking help for the same. I also appreciate it if someone shares their experiences about how they build the logic for a problem.

I really appreciate any help you can provide.

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

»
3 года назад, # |
Rev. 3   Проголосовать: нравится +14 Проголосовать: не нравится

Bad news friend. You are doing it wrong.

You don't reverse engineer the logic from the code unless you are familiar with the patterns/strategies that are being used in the code (e.g. you can recognize a well known algo from the author's code).

You should be trying to understand the author's logic first before looking at his code. Better still if you can use the logic to write code of your own (and maybe look at the author's code for hints along the way). This is what will help you improve.

If you cannot even understand the logic to begin with, then the problem is too hard for you. Try an easier one.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +27 Проголосовать: не нравится

    I've used reverse engineering to get better when I was div2 so I don't see it as that wrong. I can agree with trying to reverse engineer the process (step by step with a debugger for example) instead of the logic being wrong.