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

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

I am involved with CP for about 2 years. If I study an algorithm I can understand it. But the problem is I'm so weak in implementation. Most of the time I fail to implement algorithms. What should I do to improve my implementation skill?

[I use only C++ language.]

Thanks.

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

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

Practice typing (not important but can give you a good feeling while implementing) 2-read others codes 3-think of all details in the implementation before implementing 4-solve more problem above your comfort zone

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

You can try to do some data structure problems those are hard to implement and solve it again the next week. Find some problems of this kind and write the code every week. If you find they're easy to code after a few weeks, other problems won't seem so hard, I think.

PS: This won't be a problem if you're a Chinese. Everybody knows we love (to make problems of) data structures! :D

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

I am not experienced/highly rated, But I think you should try solving problems by keeping tag of implementation while practicing.
I improved a little bit by doing these

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

I recommend solving problems rated about 1300-1400, because you're rated about 1250 as of now, because I find that those ones usually have simpler algorithms, but may be more implementation-based.

Also, no need to just do cp problems. I've improved my implementation skill by doing other things with C++, like creating a custom Fraction class, and using lambda functions in general.

What's the main part of implementation that you struggle in? Edge cases? Or just applying the algorithm to the problem.

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

    Hi , i am relatively new to CP and have been facing the same issue of implementation.

    I can easily think of the algorithms used in 1400 — 1500 rated problems but end up over complicating the implementation part thus failing to solve the problem.

    If you can suggest something it would be very useful.

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

      To implement fast you need to write as few lines of code in the fast possible way. Refine your logic, visualize the data structure in your head. Or, copy paste the data structure template directly to be even faster. Most importantly you need to refine your thinking and making it super duper easy to understand. That way it will be super fast.

      When you are given easy problems you can solve in 1 minute but a bit harder then it takes 1/2 hours. It means you have to have crystal clear ideas. Find analogies, pictures, equivalence relations and you are going to become RED definitely but also have to put in a couple of years :)

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

      This is just like shortest path problem. If you keep on practicing you'll find nodes in problem solving graph that you can follow to reach to the goal starting from the problem description. The more you explore problems, more ideas you explore, merge the ideas, refine and find more shortest paths :)

      BTW, do you like BFS or dijkstra ? :P