CP Roadmap
CP Roadmap
INTRODUCTION:
➡️ What is CP?
It's a mind-sport where you are given a problem and have to develop optimised
solutions for the given constraints with your coding skills. This helps us in
building our logical and analytical thinking skills and also in enhancing our
knowledge.
Now, the question is how we can do Competitive Programming.
What’s better than some advice from the best to get started?
● How to start Competitive Programming? For beginners!
● How To Become Red Coder? (codeforces.com)
➡️ Pre-Requisites -
What text editor or IDE should I use for competitive programming?
Some of you may have thought about which editor to be used for competitive
programming. Well, some of the good editors for CP are Sublime Text (for both Linux
and Windows), CodeBlocks (for Windows only), and Geany. However, if someone still
uses online editors (GeeksForGeeks, Codeforces, Ideone, or CodeChef IDE), switch to
offline editors as soon as possible. Online editors should not be used during the contests
because the site may crash at that time, and you may lose the unsaved code. Also, if you
are using Ideone or Pastebin, your code may get stolen, and you might be caught in
plagiarism.
Now talking about the offline editors, if you have Linux installed on your laptop, you
can easily set up Sublime Text on it. (Installing Sublime Text on Linux, Set Up Sublime
Text in Linux). However, if you are using Windows, try setting up Sublime Text
(Sublime Text for Windows). However, if it is giving any errors which you are not able
to resolve, then you can set up CodeBlocks easily on your system. You can also set up
Geany on your Linux system if you want.
(Linux setup for Competitive Programming (with Geany))
➡️ Week I -
✧ So, in the first week, we will start with the most essential things required
for CP, which are Learning a Language and Understanding Time and Space
Complexity.
✧ On the language part, we would be learning C++ because it’s the most
commonly used language in CP for two main reasons: a. It’s faster than any
other programming language in terms of speed, and b. It has a very vast Standard
Template Library (which we are going to cover in the upcoming weeks)
✧ BREAKDOWN -
Introduction to C++ -
- Basic Syntax and Structure
- Input/Output in C++
- Comments in C++
Conditionals in C++ -
- If-Else Statements
- Switch-Case Statements
- Ternary Operator (Substitute for if-else)
Loops in C++ -
- While and do-While Loops
- For Loop
- Break and Continue statements
Arrays in C++ -
- Introduction to Arrays
- Multidimensional Arrays
Strings in C++ -
- C-Style and C++-Style Strings
- More with string Object in C++
Practice Time !!
- Reverse words in a given string
- https://codeforces.com/problemset/problem/1760/B
- https://codeforces.com/problemset/problem/1703/C
- https://codeforces.com/problemset/problem/1758/A
Functions in C++ -
- How to create Functions?
- Default Arguments in a Function
- Passing Array to a Function in C++
- Call by Value v/s Call by Reference
Recursion -
- Introduction to Recursion in C++
- Recursion and Backtracking
Practice Time !!
- https://www.codechef.com/problems/FIBXOR01
- https://www.geeksforgeeks.org/partition-set-k-subsets-
equal-sum/
- https://www.geeksforgeeks.org/given-a-string-print-all-
possible-palindromic-partition/
Practice Time !!
- As an exercise, you can analyse the time complexity
of the problems you have solved till now and figure
out the bound of the algorithm used using the Big-
O Notation.
- Trick questions from Time & Space Complexity -
Coding Ninjas CodeStudio
Day VII Practise day? Check out the resources given below, like
ladders etc.
You guys can now do lower-rated Codeforces problems
(<1300) on A2OJ Ladders and Introductory Problems on
CSES Problem Set…
A2OJ Ladders
CSES Problem Set - Tasks
Solve C++ | HackerRank
➡️ Week II -
✧ We are going to cover C++’s Standard Template Library or STL in the upcoming
two weeks (Week II and III).
✧ What is STL?
STL contains a lot of predefined functions and data structures that can be used in CP.
So it becomes important for us to learn STL to improve CP.
✧ You can go through this link to get an overview of STL.
✧ Since STL has a lot of functions and predefined data structures in STL, it can be
overwhelming to go through every one of them. So we will be covering only some of the
most useful data structures in STL that you are most likely to encounter during your CP
journey.
✧ BREAKDOWN -
Day I Iterators -
They are very similar to pointers in various ways, it might
be a little tricky to fully understand without any prior
knowledge of STL containers.
But try to read about them from this blog.
To iterate over Different containers using a Range-based
for loop in C++ provides a sleek syntax.
Lambda expression -
You can read about it from Lambda expression in C++ -
GeeksforGeeks.
These are useful when you want to write custom
comparator functions.
Practice Time !!
- https://codeforces.com/contest/903/problem/C
- Ferris Wheel
- Musical Rods - Problems | CodeChef
- https://codeforces.com/problemset/problem/492/B
- https://codeforces.com/problemset/problem/1545/A
Pair -
Pair is a relatively simple container, defined in STL, it is
used when we want to store two data together.
Give it a read from this blog.
Practice Time !!
- The Monk and Class Marks | Practice Problems
Day IV Vectors -
Practice Time !!
- Maximize the sum | Practice Problems
- Minimum operations | Practice Problems
- Infinite arrays | Practice Problems
Practice Time !!
- https://codeforces.com/problemset/problem/1566/A
- https://codeforces.com/group/ctEtdi2TSJ/contest/396408/p
roblem/A
- https://codeforces.com/group/ctEtdi2TSJ/contest/396408/p
roblem/E
- https://codeforces.com/contest/1370/problem/D
Day VI Stacks -
Stacks are a type of container with LIFO (Last in First
Out ) type of work, where a new element is added at one
end (top) and an element is removed from that end only.
You can refer to this article to learn about syntax and
basic functionalities in the stack.
Practice Time !!
- Parenthesis Checker | Practice | GeeksforGeeks
- https://practice.geeksforgeeks.org/problems/next-larger-
element-
1587115620/1?page=1&category[]=Stack&sortBy=submissions
- Longest valid Parentheses | Practice | GeeksforGeeks
Day I Queue -
Queue is a type of container adapter that operates in a first in
first out (FIFO) type of arrangement.
More about the queue here and in this blog.
Practice Time !!
- First negative integer in every window of size k | Practice |
GeeksforGeeks
- Disk tower | Practice Problems
Practice Time !!
- https://codeforces.com/contest/4/problem/C
- Subarray with 0 sum | Practice | GeeksforGeeks
- Sum of Two Values
- CSES - Subarray Sums I
Practice Time !!
- Twice Counter | Practice | GeeksforGeeks
- https://codeforces.com/contest/855/problem/A
- https://atcoder.jp/contests/arc087/tasks/arc087_a?lang=en
- Monk and the Magical Candy Bags | Practice Problems
- https://www.geeksforgeeks.org/largest-subset-of-array-
having-sum-at-least-0/
Practice Time !!
- Monk and the Magical Candy Bags | Practice Problems
- K-th Largest Sum Contiguous Subarray | Practice |
GeeksforGeeks
Now, that you know a lot of stuff so you are a lot more likely
to make a lot of mistakes so here is a video that would be of
great help
C++ Mistakes Noobs Make (and how to prevent them)
By now you are well familiar with C++ STL, so you will be
better able to appreciate this blog and use it: C++ tips and
tricks - Codeforces.
➡️ Week IV -
✧ So, in the fourth week, we will be covering some miscellaneous topics
that are very much essential as you proceed higher up in the domain of
Competitive Programming.
✧ The topics include - Prefix Sums, Number Theory, Dynamic
Programming and Bit Masking.
✧ This section is more about practice, the content would be very minimal,
but you can improve your grip on these topics by practising more and
more…
✧ BREAKDOWN -
Practice Time !!
- Problem 2. Hoof, Paper, Scissors
- Power of Points
- Forest Queries
- Problem 2. Subsequences Summing to Sevens
Practice Time !!
- CSES - Exponentiation II
- CSES - Counting Divisors
- CSES - Sum of Divisors
- https://codeforces.com/contest/1349/problem/A
- https://codeforces.com/contest/1758/problem/D
- https://codeforces.com/contest/1811/problem/D
Practice Time !!
Try implementing addition and multiplication using bitwise
operators only (you can use
loops)https://codeforces.com/problemset/problem/1514/B
- https://codeforces.com/problemset/problem/1615/B
- https://codeforces.com/contest/1758/problem/B
- Counting Bits
- Maximum Xor Subarray
- https://codeforces.com/contest/1207/problem/E
- https://codeforces.com/contest/276/problem/D
- https://codeforces.com/problemset/problem/1614/C
Practice Time !!
It is an excellent idea to solve the entire CSES ‘dynamic
programming’ section (except the last 2-3 questions).
Some selected problems are given below:
- Coin Combinations I
- Coin Combinations II (contrast with the previous problem)
- Two Sets II
- https://codeforces.com/problemset/problem/455/A
- Longest Common Subsequence - LeetCode
- CSES - Projects
Sliding Window -
Day VI - Sliding Window Technique
Practice Time !!
- https://codeforces.com/problemset/problem/279/B
- https://cses.fi/problemset/task/1077
- https://cses.fi/problemset/task/1076
➡️ Week V -
✧ So, in the five week, we will be covering some advanced data structures
topics that are very much essential as you proceed higher up in the domain
of Competitive Programming.
✧ The topics include - Basic Graph Theory, Trees and Segment Trees.
✧ This section is more about learning , there week will be containing heavy
learning, but you can improve your grip on these topics by practising more
and more…
✧ BREAKDOWN -
- William Fiset
- Reducible
Practice Time !!
- https://atcoder.jp/contests/abc315/tasks/abc315_e
- https://codeforces.com/problemset/problem/1843/D
- https://codeforces.com/problemset/problem/1830/A
- https://codeforces.com/problemset/problem/1143/C
Contributors -
● Sanat Goel | 9779589799
● Vipul Chanchlani | 9462150839
● Goutam Das | 9827708951
● Rishi Agarwal | 7071377085
● Varun Tokas | 9990825216
● Shivam Mishra | 8604397668
● Chayan Kumawat | 9569426190
● Prerak Agarwal | 8528203343
● Sankul | 9315719561