### sunnyz's blog

By sunnyz, history, 12 days ago,

Hi friends, I was recently bugged by this issue. I often find out that my coding ability doesn't support my thinking, and it often results in messy and chaotic code. For instance, on recent div3 D, I struggled to miss details. (I know the correct way to solve the problem) I've tried to practice more, but it often ends up with the same issue. So my question is, how do you improve your coding skill? (to the level where once you have an idea, you can instantly convert it to code)

• 0

 » 12 days ago, # |   0 I think you should practice problems with implementation tag. These questions are meant to be easier on thinking side but tougher to implement (or implement in a little nicer way).Also reading other people's code to see what better ideas (or better coding style) exist out there. For example: Problem LinkImplementation 1 by touristImplementation 2 by some random personThe first one is definitely better and shorter, isn't it? :)
•  » » 12 days ago, # ^ |   0 Ok, thanks for the advice!
 » 12 days ago, # | ← Rev. 2 →   +11 Simple: if you miss the details then you don't know the correct way to solve the problem. Details aren't implementation specific.For a way to improve it, read other's codes after solving especially when you have trouble implementing. At your level you'll often find a red that will solve a problem that your solution takes 60 lines of code in 20 lines.
 » 12 days ago, # |   0 You can do more VPs. They improve your coding speed.
 » 12 days ago, # |   0 Simple. Just grab 5-6 problems that have the implementation tag, create a virtual contest, and try to speedrun the whole thing. You will eventually get better at implementation. It is also advisable to read top coder's code
 » 12 days ago, # |   0 the suggestions above are all great, while here's my suggestion — use syntactic sugar at the right place, at the right time. They can help you write shorter and yet readable code. You can utilize the same reason Python is easier for many people, even in C++. In recent standards, C++ does strive to learn from other languages (still in its own way though), such as range-based for statements and many more. these features are what are called syntactic sugar, and used in the right situation, they give you a great deal of benefits.
 » 12 days ago, # |   +6 I'd say the two are quite related, the more clearly you can think, the more easy it is to translate it to code.If you have a rough idea but not very clear about the details/how to implement it, your code will be messy as you try to figure out the details as you code it. If you can think more clearly at a problem, then your brain will fill in the in between steps much faster and coding it will be cleaner. This kind of working out of details is also part of problem solving skill, and while it may not be as fanciful as magic observations, it's still very important. Often it's useful to spend a few more minutes thinking about details before jumping to code.That being said, I think it is very normal for you to only have a rough idea and when coding you find it's messy with missing details. This usually just means you're doing a problem which is challenging for you (and has alot of details to sort out), and is a problem that everyone faces including strong coders. As such, I think you don't need to worry too much about implementation skill. Implementation and thinking about details typically go hand in hand, and improving problem solving skills also improves your ability to handle details when coding.