How to Learn Competitive Programming
What is Competitive Programming?
Competitive Programming is the act of utilizing algorithms and mathematics in order to discover and apply the optimal solution to a given problem. Competitive Programming requires logical reasoning and creativity in order to understand, solve, and efficiently complete the problem. Competitions typically consist of several programming questions being given, and participants attempting to create solving algorithms and programs that can complete a task within a given runtime.
How are Problems Solved?
Competitive Programming competitions are run on the basis of problems that require algorithms to solve. All of these algorithms are public knowledge and can be learned with enough effort. The main difficulty in the problem comes from understanding the problem, fashioning the input to the algorithm, choosing and implementing the RIGHT algorithm, fashioning the output, and keeping runtime low. Many of these skills can only be acquired through practice, but skills such as understanding what algorithm to use and how to implement it must be learned.
What Programming Languages Should You Use?
There are countless programming languages out there. Many of them have their uses, but not all of them are useful for competitive programming. This is because not all languages are efficient, or because they lack some crucial features required for competitive programming. Additionally, most problems and guides are designed with certain languages in mind. What are these languages you may wonder? They are C++, Java, and Python.
What Programming Language is Best for Competitive Programming?
Objectively, C++ is the best language for competitive programming. Don’t just take my word for it, look at this data from the most recent United States of America Computing Olympiad:
C++ is the best language due to its extreme efficiency at running algorithms and programs. Additionally, Java is acceptable in the majority of situations, though there is often more work needed to get Java programs to run within time limits. Finally, Python should only be used for introductory levels of competition and for students who do not happen to know any other language, as Python executes extremely slowly and often runs over the time limit.
What Should a High Schooler Learn for Competitive Programming?
A high schooler must first know how to program in C++, as well as all of the intricacies of the language. The best place to learn this is on Learn C++. Understanding your programming language is essential to Competitive Programming, as many languages have inbuilt functionality for more efficient computation and better algorithms.
The next thing to learn is to understand different algorithms. The best place to learn these algorithms is on CP-Algorithms. Here users can learn how an algorithm works and how to implement it. An in depth explanation of each algorithm provides the user with the intuition and understanding needed to use the algorithm in their programming. Another thing that users must know is the relative importance, difficulty, and efficiency of each algorithm. By understanding the importance of each algorithm, users can properly focus time and effort on these algorithms. Additionally, overly difficult algorithms will not be tested in low levels of Competitive Programming. Finally, understanding the efficiency of each algorithm of a certain type, such as sorting algorithms, will allow the user to understand which ones are efficient when implemented and which ones are slow.
Finally, Competitive Programmers must get countless hours of practice in order to succeed. The best form of practice is to work in the same environment you are in during a contest, no access to google and a time limit. By practicing like this, learning is optimized and stress during an actual contest is reduced. Additionally, remember to practice slightly above your actual skill level to force learning through discomfort. Some great places to practice are through websites such as LeetCode and Codeforces. Finally, a great resource to find information about competitive programming is the USACO Guide.
What Contests can you use your skills in?
USACO
The United States of America Computing Olympiad, or USACO, is the most prestigious high school competitive programming competition. All participants compete in one of 4 divisions. The contest questions provided for each level vary vastly in difficulty. The main languages used in these competitions are C++, Java, and Python. Contests run from 3 to 5 hours in length, for solving 3 problems.
The Bronze division is the starting division in USACO. Participants will require some programming knowledge, but algorithmic knowledge is not required. Typically problem solving skills and logical reasoning is the basis for most solutions. Some math ability is additionally recommended. Contestants who score above the cutoff will be promoted to the Silver division.
The Silver Division is where most serious competitive programmers are. Participants will require comprehensive programing and algorithmic knowledge. Great problem solving and logical reasoning skills are a necessity in this division. Strong mathematical prowess is helpful for problem solving. Contestants who score above the cutoff will be promoted to the Gold Division.
The Gold Division is where some of the best programmers are. There a a little more than 1,000 active individuals in the Gold division. Participants will require detailed algorithmic knowledge to succeed. Problem solving and logical reasoning, as well as creativity, are mandatory in every facet of this division. Intricate mathematical knowledge is a prerequisite to solving problems in this division. Contestants who score above the cutoff will be promoted to the highest division, Platinum.
The Platinum Division is the highest division with the best of the best. A little over 300 active participants exist in the division. The problems require complete mastery over algorithms as well as the ability to creatively manipulate them. Extremely high level knowledge of mathematics is required to solve problems in this division. Top scorers in this division may be invited to USACO Camp over summer, where they may later train to represent the US at the international level.
USACO has 4 contests every single year. The first three contests each year involve 3 questions that must be solved in three hours. The fourth contest each year, the US Open, is a five hour long contest that involves solving three problems. Signing up for any contest is as simple as going to the USACO website and registering.
American Computer Science League
The American Computer Science League is a competition focused more on the fundamental mathematics and theory behind computers. There are four contests each year, consisting of 5 short answer questions and 1 programming question. Top performers during the four contests will be invited to Finals at the end of the year.
The contest has five divisions, with the Intermediate and Senior Division being the divisions that High Schoolers should participate in. This competition focuses on both individual and team scoring, though only individual scoring is considered for participation in finals.
Common topics included in the competitions include Number Systems, String Manipulation, Boolean Algebra, Data Structures, Graph Theory, Assembly, and Digital Electronics.
Resources for this competition can be found here: ACSL Website ACSL Category Descriptions
Best of luck in your future competitive programming journey.
About Inspirit AI
AI Scholars Live Online is a 10 session (25-hour) program that exposes high school students to fundamental AI concepts and guides them to build a socially impactful project. Taught by our team of graduate students from Stanford, MIT, and more, students receive a personalized learning experience in small groups with a student-teacher ratio of 5:1.