project2400's blog

By project2400, history, 5 months ago, In English

I'm finding that I'm spending an equivalent amount of time implementing vs. generating ideas.

I feel like this is slow for problems that aren't specifically tagged as implementation.

Can any expert+ coders comment on how their breakdown typically goes? Bonus points if you can break it down by problem category.

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

»
5 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

im not expert coder but it honestly depends on difficulty of problem as say for an 800 problem idea may take 10 seconds but the implementation might take 2 minutes whereas a harder problem may take an hour to come up with the idea for but only 10 or so minutes to implement

»
5 months ago, hide # |
Rev. 3  
Vote: I like it +3 Vote: I do not like it

Broo there is no constant time for implementation.

But I actually follow a strategy, DON'T IMPLEMENT ANYTHING BEFORE YOU DRAW THE CODE IN YOUR MIND ..

I mean don't implement while thinking.

If you really follow this you'll save a lot of time..

»
5 months ago, hide # |
Rev. 2  
Vote: I like it -8 Vote: I do not like it

It's probably because you name your variables things like this

Naming variables more than 2-3 letters in competitive programming is bad practice unless you have a really good reason to name it longer

  • »
    »
    5 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Hmmm, I find myself getting lost if I don't use human-readable names though

    I don't think my working memory can handle a bunch of a, b, c, etc

    • »
      »
      »
      5 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Maybe you really can’t, but you should try nevertheless. Saying or thinking "while A times B greater than C" is faster and easier than whatever you do with "human-readable" (as if programming languages are not human-readable already). Long names are good for slow-paced work in a big team. You don’t need it, when you solely want to make a computer run your idea and then forget about it.

      • »
        »
        »
        »
        5 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Makes sense, let me try.

        • »
          »
          »
          »
          »
          5 months ago, hide # ^ |
           
          Vote: I like it +3 Vote: I do not like it

          TBH with tab complete it's not that big of a deal. You'll save like 2-3 minutes per problem at most maybe. If longer names help you (they occasionally help me), the time save will not be worth the lost time from debugging.

  • »
    »
    5 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    i vould say 3-4 is golden and i would reccomend also not using unnececary arrays etc: when you are writing a double seg tree iteration you can use an array of two vectors or a vector of two integers or a pair of vectors etc.

  • »
    »
    5 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Maybe AI is the reason?

»
5 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

You can use templates and get used to them if you want to speed up your implementation a bit. Another good practice is to think more about the problem, make sure you have the full solution completed in your brain (or some sort of drawing/writing will also work), and then implement. This will help you make fewer bugs and implementation mistakes. Except for that, it really does depend on the person, problem, and solution you come up with. Some solutions are simple, some are not. You'll definitely get faster as you participate in more contests.

»
5 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

I usually spend 10 minutes implementing a problems, then spend 2 hours debugging it.