thedominator's blog

By thedominator, history, 4 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

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

for me,I write my code every time

»
4 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.

  • »
    »
    4 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

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

      Maybe that's why it is named lazy propogation lmao

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

      • »
        »
        »
        »
        4 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

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

»
4 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.

»
4 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.

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

we need another relation between rating and *** research

»
4 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.