Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
250 views

Competitive Programming Starting Guide

Competitive programming involves solving problems within time and memory constraints. It tests efficiency and problem-solving skills. Competitors submit solutions to online judges to be evaluated on test cases. The goal is to receive an "Accepted" verdict by passing all test cases. Competitive programming improves critical thinking, teaches algorithm design, and is used by companies like Google for hiring. It begins with basic problems to learn languages, algorithms and data structures, then progresses to more complex challenges. Practice, debugging, and learning from editorial solutions helps competitors improve.

Uploaded by

The cidaCoder
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
250 views

Competitive Programming Starting Guide

Competitive programming involves solving problems within time and memory constraints. It tests efficiency and problem-solving skills. Competitors submit solutions to online judges to be evaluated on test cases. The goal is to receive an "Accepted" verdict by passing all test cases. Competitive programming improves critical thinking, teaches algorithm design, and is used by companies like Google for hiring. It begins with basic problems to learn languages, algorithms and data structures, then progresses to more complex challenges. Practice, debugging, and learning from editorial solutions helps competitors improve.

Uploaded by

The cidaCoder
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Magazine

“Connaught Place isn’t the best place to find bug so the CP is where I go”

Competitive Programming (CP) is like a sport and many do it for just fun. If you are into programming,
you can give it a try!

Computer Programming is a process to solve real world problems with the help of a computer (a
dumb tool to perform lots of repetitive tasks, efficiently) and Human made Algorithms.

On the other hand, Competitive programming is a kind of mental sport where you have to solve
problems within certain constraints.

In Competitive Programming (CP) there is always a judge, which runs your program on several inputs
and validates it. You get a verdict based on how your code performs on the test cases.

(can remove)

Phases: You are going to go through: **

 AC (Accepted) - Rejoice! Your code passes all test cases given by the judge and is deemed
correct.
 Time limit ( about a few seconds ) - You get a verdict of "Time Limit Exceeded" if your
program doesn't terminate in time.
 Runtime errors - These occur when your code is prone to faulty pointers and stuff. Keep an
eye if your code breaks for large inputs.
 Wrong Answer - This means that your code produces incorrect output.
 Constraints on input - most important, this gives you an idea about how fast your algorithm
should be.

Compile a code and submit, you may get a WA (Wrong Answer). Hunt the bugs (make changes to
code) and eventually you will get your first AC.

Competitive Programming Plateforms:

 Hackerrank: has a very good section of tutorials aside from contests. Practise problems
are topic wise.
 Hackerearth: Best section of tutorials and blog to which can help. It also hosts
Hackathons which are very helpful and hiring contests.
 CodeChef: hosts 3 contests Long, Cook Off and Lunchtime which is its forte. Aside from
that it also hosts contests for various colleges and also ACM style contests.
 Codeforces,SPOJ,Topcoder: they have some good level of problems and best
distribution of them according to DS or algo used.
How to Start?

The whole Idea of CP is based on 4 main pillars Programming Language, Algorithms, Maths, Data
Structures.

You don’t need to know any “fancy name” algorithm or data-structure to get started.

You just need :

 Basic Knowledge of any one programming language.

 Register on any online judge

 Read the problem statement

 Understand the input values carefully & expected output and its format

 Use pen/paper to get the logic behind problem’s solutions

 Give input values/test cases & check the output values

 Submit the soln to the online judge

Levels Up

To start in this field you just need some basic knowledge of any programming language.

About 20% of questions in a programming contest are simple conversion of basic english to a code in
your favorite programming language. So Start by solving 10-15 basic level Questions where mostly are
just conversion of English to Code.

When you get familiar with Environment of CP then start learning some basic Algorithms like
Searching, Sorting, Prime Num Generator, Number Games, Modular Arithmetic and Modular
Inverse.

Then go to the easy level and do at least 10-15 question of easy level.

Sometimes problem do not directly say to apply some of these algorithms, problems appear complex,
you just need to figure out what, when and where to apply them.

After this, you are prepared to appear for Online programming contests, but you might be able to
attempt only 1 or 2 problems.

Now you need to know some actual Competitive Programming skills like Trie, Segment Tree, map,
pair, BST, Hashing, Dynamic Programming, sieve of Eratosthenes, 0-1 Binary Search, Bellman Ford.

Dynamic Programming is the most important weapon in this battle of code.


Algorithms and Data Stuctures

 Sorting, Searching Algo


 Number theory
 Hashing
 Sieve of Eratosthenes for Prime Numbers
 0 1 Addition of Binary Search
 Map
 Pair
 Vectors
 BST
 BFS/DFS
 Dijkastra, Bellman Ford
 MST
 Longest Common subsequence
 Longest Increasing Subsequence

Why do we?

Many programmers argue that competitive programming do not relate to the real world programming
Stuff. To a point, yes it is true but

 It makes you think out of the box, which help you to develop better ideas in real world
Programming.
 iTie you up with the time constraints and ask you to right efficient code, which make yourself
ready to survive & win in the real life technology competition.
 Improve your Critical Thinking Capability, which help one in debugging at crucial time.
 Teach you how to break the code into chunks and then apply Bottom up Approach.
 Makes you a desirable candidate to major companies like Google, Amazon,
Facebook.

Opportunities

Now a days, almost all major companies are hiring candidates through competitive programming.
They conduct their Qualifier Online as a Programming Contest and then select candidates based on
their performance. Some of them are :

CodeVita: TCS conducts codevita, competitive programming contest and hire candidates. There are
3 Rounds, first 2 rounds are online and last one in Onsite based on Competitive Programming.
HackWithInfy : Infosys started this competition in 2018 and hire student for different profiles
according to their performace. There are 3 Rounds out of which first 2 rounds are based on
Competitive Programming and Last Round is an Interview Process. This year 4 Student directly got
placed in Infy from MITS through HackWithInfy .

Google code jam and kickstart: international programming competition hosted and administered
by Google. There are total 5 Rounds and the top coders get chance of Interview in Google.

CodeSprint-Amazon: CodeSprint Amazon India is a 2 week long coding contest where you can
apply for Amazon. It will have 4 problems and last time conducted on Hackerrank.

Facebook Hacker Cup: Facebook Hacker Cup is an international 'programming competition


hosted and administered by Facebook. Hacker cup is conducted in 4 series round.

ACM-ICPC: The International Collegiate Programming Contest is an


algorithmic programming contest for college students. . There are 3 Rounds, first rounds is online
qualifier round then regional round from where some team get selected to represent the country and
in Last round called World Finals.

X-perience:

Efficiency and Speed are the two most Important Criteria of CP.
Sometimes You will come to a situation when you simply translate the code but Got TLE. Then you
have to apply some algo and presence of mind to solve the same problem with some efficient logic that
will lead you towards AC.

There may be many ways to solve the problem, you may get some way to crack it but still not succeed
in getting “Answer Correct” may be bcoz your technique is not efficient one. It is the best part of CP,
You know the solution but you can’t succeed bcoz u r not efficient, At this time, do not leave the
question instead focus to find the better way to solve the same problem. Bcoz moving without
improvement just create a bubble around you and you start believing that you are learning something
but actually time is just going away and u r still at the place from where you started.

So always keep these things in mind:


 Use pen/paper to test your approach.
 Check your Code on Extreme test cases, write test cases (covering boundary conditions) and
check outcomes.
 Compute the time complexity according to given constraints and try to reduce it.
 Select appropriate data structure and Algorithms.
 Modular Arithmetic and Modular Inverse plays important role when output is required in
some limit.
 If you are sure that you have tried a lot and still you r not getting the correct Solution then go to
the Editorials and read them, try to find the fault and make sure you always learn something
new from Editorial.
 WA or TLE means you are going towards the success so don’t leave here.

During Live Competition:


(closing statement)Keep Hunting bugs ;)

It feels awesome when you are representing your college fighting with time and limits just to get AC
that pressure, environment and feeling is awesome.

In my starting days of college, once 3 super senior entered into our classroom during Lunch break and
asked about coding then they informed us that a they are conducting a online College level
Competitive Programming Competition. This is the first time I hear this term for the very first time. I
researched over it, made an account on codechef and start coding.

I still remember my first problem is addition of 2 digits and it took 11 submissions to write & submit it
correctly.

Honestly speaking, at that time, I hated this thing and decide not to go further into it.

You might also like