Showing posts from June, 2021

Implementation tips for competitive programming

Implementation tips for competitive programming It’s uncommon for code you write to work properly the first time you run it. And if you’re not careful, you can spend hours debugging and still be left with code that doesn’t work. This is especially problematic in ICPC, when you have only one computer between three people. Below are a few tips on how to improve the implementation and debugging process.  Before you start implementing Proving your solution Once you have a solution, the first step is to convince yourself it is correct. If you skip this step, you could invest a lot of time into coding only to later realise that your entire idea is incorrect. You don’t need a formal mathematical proof, just enough that you are sure it works. When doing this, try to think about the worst cases which could break your algorithm, and then reason why they do or do not.  Planning your code Once you are sure you have a correct solution, the next step is to