thedominator's blog

By thedominator, history, 3 years ago, In English

I'm currently targeting Div2D Problems and since Div2d sometimes needs some Data structures/algos, i just want to ask do you guys Implement big codes everytime or you just copy some templates and modify them according to the question in a contest?

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

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

for me,I write my code every time

»
3 years ago, # |
  Vote: I like it +58 Vote: I do not like it

I think it's uncommon for recent div2D's to require anything bigger than a fenwick tree though.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    I was solving an old 2c problem and it required segment tree with lazy propogation and I was feeling so lazy to implement it so I asked

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +19 Vote: I do not like it

      Maybe that's why it is named lazy propogation lmao

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +16 Vote: I do not like it

      Can you show a link? I get the feeling that it doesn't require lazy propagation, it's just that you came up with a solution that has lazy propagation.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        52C - Circular RMQ I just studied segment tree and I haven't solved this problem yet so yeah i may be wrong

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it +47 Vote: I do not like it

          Ok yeah, in this problem lazy propagation is probably the most common solution. However I don't think "Codeforces Testing Round #1" can be equated to a Div. 2 round.

          Anyway for your original question, it depends on the algorithm, length of the code and how comfortable I am with it too. Lazy propagation I usually write myself.

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

I write them everytime to practice implementing and debugging, even while I'm participating in contests.

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

Yes, of course. I am righting them again, again and again. In the contests too. For me rating doesn't matter, I participate in contests for increase my implementation skills, not for copy paste skills.

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

we need another relation between rating and *** research

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Copying templates is much faster and less mistake-prone. The more of it you can do the better.

You definitely need to understand the code though, so it's best to write your own library. Also, if you are only trying to learn, it can be helpful to write algorithms from scratch, until you are very comfortable with the implementation.