Mooncrater's blog

By Mooncrater, history, 4 years ago, In English

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 :)

  • Vote: I like it
  • -18
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Practice + Fast typing speed + template + Not reading the whole story of the problem (In case possible).

»
4 years ago, # |
  Vote: I like it +9 Vote: I do not like it
  • 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.

»
4 years ago, # |
  Vote: I like it +41 Vote: I do not like it

Don't focus on that, one extra problem for you is way better than being 5 minutes faster in easy problems.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    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.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      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.