### Mooncrater's blog

By Mooncrater, history, 5 weeks ago, ,

I have seen manytimes, that the winner of a Div 2 contest has solved both the A and B problems in less than 6 minutes. How is that done? You have to read, think and implement a question. Unless it's answer is a single line, it takes some time to implement a solution. I tried to solve a series of Div 2 B questions to increase my speed, and if the solution is obvious it takes me approximately 6-7 minutes, and otherwise 11-12 minutes.

I know that these people have a lot of practise, but is there any other tip they can share so that I (and other people like me) can improve our speed in contests?

My solving procedure: 1. Read 2. Think, come to a solution (ummm, obviously)

I do not use a template. I include #include<bits/stdc++.h> library. Then I do a using namespace std;. Then since writing for loop many times takes time, I define a macro like #define f(i,s,n) for(int i=s;i<n;i++). And then I start implementing. Since these questions are much easier, we mostly don't need another method.

Do templates save time here? Is there any other improvement I can make?

Any suggestions are welcome :)

• -18

 » 5 weeks ago, # |   0 Practice + Fast typing speed + template + Not reading the whole story of the problem (In case possible).
 » 5 weeks ago, # |   +9 sometimes it's not necessary to read the whole statement, just read the input/output sections (try this at your own risk, it's not always good). if it's an easy problem and you are sure of your code, don't waste time compiling and testing (submit at your own risk without even compiling). use some external tools like Hightail for automatic testing, it helps a lot. of course pre-written template helps a lot (minimize the #of keystrokes). you could try creating a mashup contest with a lot of Div2 A problems, and try different methods, and measure your performance.
•  » » 5 weeks ago, # ^ |   0 Great advise! Thanks!
 » 5 weeks ago, # |   +41 Don't focus on that, one extra problem for you is way better than being 5 minutes faster in easy problems.
•  » » 5 weeks ago, # ^ |   0 +3000 contestant would've solved the first 2 problems for example, so he wants to make sure at least he's the top among those 3000 If he couldn't solve more that 2 in the worst cases.
•  » » 5 weeks ago, # ^ |   +1 Actually that is my intention. I have seen that I can solve C and sometimes D, but there just isn't enough time. A and B take 20-25 minutes. That leaves much less time for C and D.
•  » » » 5 weeks ago, # ^ |   +1 If you focus on improving solving in general, you'll get faster at solving those problems naturally. If I were to give you an advice, try to reflect on why you take that long on solving these problems instead of solving more problems (sometimes at least). Maybe look at code from other participants to find tricks on how to make code simpler or shorter. All that comes with time if you practice enough.
•  » » » » 5 weeks ago, # ^ |   0 Aye aye cap'n.