What is Competitive Programming?

Introduction

In Competitive Programming, competitors are given a set of programming problems to solve within a given period. The competitor who solved the most problems or has accumulated the highest score is declared the winner. Competitors need to train and practice to win, just like in sports or games. The types of programming problems usually involve data structures and algorithms as well as math concepts.

How to start?

First, learn the basics of programming and the features of the programming language you want to use. After taking CMSC 12, CMSC 21, and CMSC 22, you should understand variables, data types, operators, I/O facilities, control flow structures, arrays, and strings, etc. of Python3, C, and Java. You should be able to translate basic algorithms, such as binary search and insertion sort, into working and correct code. A little bit of OOP knowledge, specifically Polymorphism and Inheritance, is important when using libraries and API.

Second, learn some Discrete Mathematics. You can get this from CMSC 56 and CMSC 57. These courses do not require coding and mostly use pen and paper. However, I recommend you attempt to implement the algorithms studied in these courses. Understand boolean algebra, set theory, probability, counting techniques, methods of proof, trees, graphs, and some automata.

Third, learn some Data Structures and Algorithm Analysis. You can get this from CMSC 123. Master implementing linked lists, stacks, queues, hash tables, trees, graphs, etc. Master analyzing the efficiency of data structures and algorithms. Knowing this is important because some problems will require solutions that have bounds in terms of time and memory use. Using more efficient data structures and algorithms might be needed.

Lastly, practice solving problems on online platforms. I recommend Kattis for beginners. Try to stay on the #1 spot (It seems like I need to catch up haha). You can actually do this after taking CMSC 57 and CMSC 22 if you are serious on becoming a competitive programmer. There are simple problems that do not require data structures at all. Note also that most problem statements have some background "story." An excellent skill to develop is how to extract the "core" problem hidden in the story. Always solve first with pen and paper before writing code. Also, make sure to consider "edge cases" in your solutions.

Problems in competitive programming are more challenging to solve than lab exercises! You might be overwhelmed when working on a problem, but don't give up easily.

Code Quality

Sadly, code for competitive programming does not need to be readable and maintainable in the traditional sense of software engineering. Your program reads an input file(or from stdin) and then writes to an output file(or to stdout). The code with the minimum lines of code that solves a problem correctly is ideal. Forget using human-readable variable names. Use the C preprocessor to create shorthands for loops etc. Sometimes you don't need to implement data structures from scratch. Use the libraries in the language, such as STL in C++ and the Java API. Though for competitive programming, I highly recommend learning C++. Improve your typing speed because time is of the essence in competitive programming.

What's in it for you?

Competitive Programming can improve your problem-solving and programming skills, which might be helpful in technical interviews when applying for a job (especially in FAANG or MAMAA). Some graduate school admission committees in CS(MS or PhD) give higher consideration to applicants who are competitive programmers. For a typical competitive person who loves CS and coding (like me haha), it's just for fun and some bragging rights.

What schools dominate the Competitive Programming landscape in PH?

Only UPD and ADMU have represented the Philippines in the ICPC World Finals several times. Other schools that regularly compete include ADNU, DLSU, UP Cebu, FEU, and PUP. Kevin Atienza is the top Competitive Programmer in PH from UPD. If my recollection is correct, he has 'sogo' in his handle because Hotel SOGO sponsored their teams way back.

From UPLB, some of the best competitive programmers are James Plaras, Froilan Tandoc, Clinton Poserio, Ken Mercado, Joshua Manalo, Anton Rufino, and Michael Angeles.

Final Notes

After completing CMSC 123 and practicing regularly (1 to 2 hours a day), you can make progress on your own. Study more advanced algorithm design techniques and solve more complex problems. Test your skills in actual competitions..

Competitive Programming is not for everyone. It requires passion, commitment, discipline, focus, lots of free time to waste, and a strong desire to win. While you're at it, enjoy and have fun!

[WARNING!! Competitive Programming can be addicting and frustrating. Git Gud.]

For more information, check this repo.