I discovered the world of competitive programming challenges during my first year at university. At that time, I knew very little about computer algorithms or even mind sports. However, the idea of learning how to code by myself, just using an online judge, attracted my attention from the first moment. I remember my first ACM-ICPC contest in 2009. My performance in the contest was terrible. With only a few weeks of training, I was unable to solve any of the problems. From that moment onward, I knew that programming contests are a real challenge, even for serious and highly motivated students.

ACM-ICPC

I started my self-training plan, and a couple of months later, I had jumped up to the first ten places in my university. Surprisingly, after four years without submitting a problem to the COJ, my user profile is still in the top 500 contestants from my country. In this post, I want to share some insights and tricks that I learned when I was a competitive programmer.

Start ASAP

There is no such thing as a good “starting time” to become a competitive programmer. It is a long process, so the sooner you start developing algorithmic thinking, the better it is for you to become a strong programmer. I believe that programming should be taught in elementary school. Just think about it, the best competitive programmers, such as the prodigious Gennady Korotkevich, started at a very young age.1

Master the Essentials First

You need to crawl before you can walk. Be sure to know the basic principles of programming before delving into more advanced topics. You must master data structures, combinatorics, number theory, geometry, graph theory, string analysis, and searching techniques. Study each topic one by one, solving problems and thinking about how to merge them.

Choose an Adequate Training Plan and Stick To It

A goal without a plan is just a wish. Of course, you need to be diligent and study all the time, but if you don’t have a good strategy, then you will advance slowly. Use a calendar to organize your training sessions. Spend one day on each type of problem; doing so makes it more difficult to become bored. I recommend not spending more than 2 hours on the same problem. If stuck, then change your activity, get some tutorial, or ask for help.

Use Good Study Resources

Start with the right foot. Choose your materials and resources carefully. As for programming languages, C++ is the better choice, but you should also know Java and its useful libraries such as BigInteger or Calendar. This is my list of recommended books for starters and intermediate contestants:

Be Persistent

Persistence is the key to competitive programming success. If you have tenacity, then you have what is needed to be a winner. I’m not kidding; there are a lot of others who don’t have enough patience. Every day, take a piece of paper and a pencil and try to think about a problem. Don’t surrender easily; choose hard problems. You will learn nothing from doing the easy ones; try to solve at least one difficult problem every day.

Be Efficient

It’s always better to spend 5 minutes thinking more about implementation rather than spending ten more minutes doing it. Learn about time complexity and the best optimization tricks. In competitive programming, the best-written code is that which you can understand, type faster, and run faster. With time, you will develop a powerful skill: the debugging mind. This means that you will be able to run the program in your mind, saving a lot of valuable development time.

Share Your Work and Ideas With Others

The best way to learn is by teaching others. This is because you need to be sure of what you know to convince others. If you find an efficient solution for a problem, then share it. In this way, you will get feedback and will learn during the process.

Keep Yourself Up to Date

Once you’ve mastered the basics, use forums to keep updated with the latest implementations. The following is a list of useful websites with study resources:

Free Your Mind

You need hard work and practice (a lot of practice) to become a competent contestant. Once you acquire an algorithmic mindset and the right skills, then only your mind will make the difference. It is a good idea to change your activities, have a hobby (I play the guitar), or spend time doing nothing. I believe that diversion is also an essential part of the training.

Enjoy

Again, life is more than a competition. After a while, you will note that competitive programming gave you beneficial programming skills, and you will feel good for having discovered it. However, always remember that professional software development for the industry is not like a contest. Sometimes other aspects (e.g., soft-skills) are more important than technical skills. The ACM-ICPC contest is just an excellent way to learn to program and acquire a good algorithmic mindset.

At UCLV, 2018
© César at the ACM-ICPC Local Finals in Cuba, 2018

Footnotes

  1. Gennady Korotkevich started programming when he was 8, his parents are computer scientists, and he has been the world’s top competitive programmer since 2013. He has won the International Olympiad in Informatics (IOI) three times and has won the ACM-ICPC World Finals five times. He is also the youngest contestant to win the Topcoder Open Algorithm competition. He is known as tourist in the competitive programming community.