Diving into the sport of competitive programming

This blog post is to guide those people who want to get started or have just started with competitive programming. I would be sharing the insights from my experience. If anything is missing or you would like to suggest something additional, let me know add a comment below.

What is Competitive Programming?

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)

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

Why CP?

By far, you would be thinking – I have been programming in programming labs in college and even school. What’s new in this CP?

Here are the few of many reasons to practice CP:

  • You will become a better, more efficient, and less error-prone coder

    • Believe me, you would not receive – ‘sum’ was not declared in this scope,  expected ‘;’ before ‘return’  – errors.
  • Your technical programming interviews will be a piece of cake

    • It would surely be a cakewalk in a long run.
  • It’s a way to focus on the fundamentals

    • In lab sessions, we work with too small values and poor-problems due to which we tend to skip the fundamentals.
    • For example, if I want to check if variable ‘sum’ is even or odd, I prefer if(sum&1) {//ODD} instead of if(sum%2==1){//Odd} because it’s faster (time efficient) and easy to write.
    • These are the things college wouldn’t teach you.
  • You will 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 infinite scrolling on facebook and checking WhatsApp if anyone messaged you!
    • You would get addicted to those little, innocent green ticks

Online Judges

There are online system to test programs in programming contest

The system compiles and execute code, and test them with pre-constructed data

The output of the code will be captured by the system and compared with the standard output

The judge would then provide you the verdict based on your program’s output. You must follow exact I/O formats. For example, do not print statements like: “please enter a number”, etc.

ojs

Don’t worry, I would write a blog on handling different errors.

Popular programming contests

Further References:

Found this guide helpful? Do follow the blog for further updates straight into your inbox and don’t forget to share with friends!

#include<heart>
int main(){
int fun = 0, knowledge = 0;
bool practice = true;
while (practice) //with practice
++fun, ++knowledge; //comes fun and knowledge
return 0;
}

 

That’s it, for now!

3 Comments

Leave a comment