Competitive Programming 101

A definitive guide on competitive programming, answering — what, why, and how?

Pratik Gadhiya
2 min readApr 30, 2017
lets-explore-the-sport.cpp

What is CP?

It’s an art of solving well-defined problems using computer programs with certain time and memory limit constraints.

well-define : problems and their solution are already know

constraints : your solution must abide by the time and memory constraints (generally, 1-2 seconds, 256Mb)

It’s Programming with Efficiency, Accuracy, and Speed (aka PEAS!)

Why CP?

By far, you would be thinking — I have been programming in college laboratories, and perhaps even in school. What’s new in CP?

Here are the few of many reasons to practice CP:

Be better, efficient and less error-prone coder

Believe me, you would not receive — ‘sum’ was not declared in this scope, expected ‘;’ before ‘return’ — errors.

Programming interviews will be a piece of cake

It would surely be a cakewalk in a long run.

Learn fundamentals

In lab sessions, we work with too small values and poor-problems due to which we tend to skip the fundamentals.

Did you know you could check whether a number (say x) is even by

if ( x&1 == 0 ) {  // is LSB in binary representation of x zero?    // x is even }

These are the things college wouldn’t teach you.

Increase your problem-solving abilities

I swear, it would create a miracle in your logic solving abilities. You would see the difference in few months.

It’s fun!

At the end of the day, you would sleep happily knowing that you did something productive instead of staring at the vicious blue screen!

Online Judges

There are several online systems to test the correctness of your programs.

Hackerearth, CodeChef, HackerRank, TopCoder, CodeForces, Spoj

Wait, how do they work?

Popular programming contests

WARNING: You may get addicted to the green ticks!

Further References:

Originally published by me at gcetcodeclub.wordpress.com on April 30, 2017.

--

--

Pratik Gadhiya
Pratik Gadhiya

Written by Pratik Gadhiya

💅🏼 software developer, 🍥 design enthusiast, 💭 day dreamer,💡 ideator — https://pgxplorer.dev

No responses yet