Skip to main content


Recent posts

Should I quit competitive programming? I am not good at it, but I like it very much?

Think about the reasons you are doing it and make a decision correspondingly.You are doing it because of some benefits you are going to get once you’ll reach decent level? Think if it is worth it - maybe you don’t have other way, or maybe you can get these benefits by doing something else and investing smaller amount of time. Or maybe you simply don’t need them. Look how much you improved over time and scale it to get some approximation on time it will take you to reach the level you want/need. You are going to improve over time. Maybe you aren’t going to improve fast. Even if you can improve quickly - it will require investing great amount of time and effort. What do you need from competitive programming? Why are you doing it? You like it very much, right? This reason sounds good enough - but you have to consider everything carefully and weight it. Just imagine that you are doing some other fun (but possibly useless) activity instead; imagine saying “Should I quit playing computer gam…

Which books should i use for competitive programming?

One must have IMO is Introduction to algorithms. It's huge to be honest, and gives both depth and breadth of a extensive coverage of different data structures and algorithms techniques. You may not need to study it from page to page, but use it as a reference resource. When you need to understand some topic, read that part in it, and this will give you a very solid foundation on algorithm analysis and design. Another book focus on math topic is Knuth's Concrete Mathematics,  I believe any ambitious competitive programmer who want to do well on math problems should read this book. If you find this book a little difficult to follow, you may also try the following book which is much easy to understand.  A Friendly introduction to number theory will teach your most of the knowledge about number theory you need in competitive programming and is extremely easy to follow. Algorithm Design by JON KLEINBERG is a book on some advanced topics on algorithm, which is very good indeed but …

level-wise breakup of competitive programming

I spent continuous 2 months of fully-dedicated work on algorithms, those were my best days, I can give advice on what felt from that time:
First you need to do some good programming in string manipulation, etc., some really shortcut coding is a must, for example using C++ STL, you need to write 1 line that will give you an understanding of about 5-10 lines. This way, you ideas will flow easily, that is, you write one/two line, what you want to do is already accomplished, so understanding of the whole library you are using is mandatory like C++ STL, etc. Searching, linear & binary search are basic. Linear is too inefficient for many tasks, you will binary search in different forms in many other topics, but it is not easy to look & understand on how to apply a binary search at first, if you modify the problem slightly, you will know a binary search operation is possible. Sorting, most times, quick sort will work, rarely others are required, I used Hoare variation implementation, no…

Good schedule to follow for becoming better at competitive programming for beginners

The three most important things in competitive programming:

Learn and know your programming language. (~3 months - all the time)
Learn algorithms/data structures and implement. (~9 months - all the time)
Practice coding every day. Do contests. (all the time)
(Doesn’t just apply to competitive programming) Have fun! (all the time)
Thus, that’ll be how you break up your schedule. The time it takes for each person will differ, depending on if you already know algorithms, if you know programming or not, etc.

The following is a more detailed how:

#1 Learn and know your programming language.

Pick a programming language and stick with it. Learn the basic syntax and start solving beginner problems. People always ask “how do you learn a programming language?” Search Google and find out; there are so many resources online. (If you really can’t find a resource, message me.)

Try out USACO training pages. Or if you don't you can use the CodeChef beginner track: beginner | CodeChef or the Code…

I have solved a lot of problems say 2000 why i have not improved till now?

The number of problems solved means little. I sometimes mention it to show passion for programming (2000+ means a lot of time spent), but it says nothing about the difficulty of the problems you’ve solved.

You have read a lot of problem statements and are should be comfortable in coding up solutions. Since you haven’t been progressing, you need to work smarter than you have till now.

I can go to Codeforces or another online judge and solve a few hundred Div2-like problems in little time. Yet, I won’t learn anything.

By now, you must know the kinds of problems you struggle with. You need to work on those. Since you’re not in Div1, my guess is that you’re not consistently solving Div2D and E problems. Focus on them. Then, move up to Div1 up to problem C.

When you struggle with a problem, say graph theory, try to study up the theory behind the key ideas and consolidate your knowledge and understanding of it.

Qualifying for ICPC WF is much trickier. Some regionals are way easier than others. I…

For an ACM-ICPC beginner, how should I start?

Most of the answers here point out places where one can solve problems. I'm going to describe an approach to approaching ACM programming contests which is a bit different. My definition of an ACM beginner is someone who has not done an ACM regional contest before and has essentially no competitive programming experience, so I will try to cover more of the details from starting on working ACM problems to competing in a regional contest.

First, get comfortable with one of C++ and Java. You're allowed to use C, C++, or Java - using C is more likely to hinder you in the long run, so get acquainted with one of the other two languages. You should be comfortable enough with the language that you can do some simple things. In particular, you should be comfortable with the following:

Reading in data from standard input (the console), or from a file. You mustlearn how to do this, since that's how interaction with the program is done.Basic arithmetic operations with integer numbers as …