decoder123's blog

By decoder123, history, 9 years ago, In English

It's almost a year I am in competitive programming, doing problems here and there. I realized that I have to solve problems to be good at this. Now what happened to me repeatedly is this-

1. Be in a virtual or actual contest.
2. Try hard.
3. I can only solve 1 or 2.
4. Contest ends.
5. Check the editorial for unsolved ones.
6.  **Can not understand the idea or feel confident enough to solve the problem.**
7. Try an hour to understand.
8. Leave it...

I have found that for this reason I an still green and I have to write this. In case of practice problems I take this approach

1. Read the question.
2. Understand and try to solve.(I try exactly for 10-15 mins..)**(Is this correct or should I try longer?)**
3. If I can't solve then I read the editorial.
4. Can not understand the idea or feel confident enough to solve the problem. 
5. Try an hour to understand.
6. Leave it...

The problem is similar here also.

My question is

1. What should I do? I mean is there any strategy to overcome this (How can I understand editorials)?
2. How much time should I give to a practice problem?

I am trying to search answer of these questions for probably a year. I want to grow but how can I if I don't understand the editorials? I want to know the art and be a "RED" someday. [For example I can't understand the #509C and #156C (div2) problems editorials..these are only the last 2 of hundreds of editorial I have read in a year.]

  • Vote: I like it
  • +54
  • Vote: I do not like it

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

Auto comment: topic has been updated by decoder123 (previous revision, new revision, compare).

»
9 years ago, # |
Rev. 2   Vote: I like it +13 Vote: I do not like it

I don't know at all why would anybody dislike a serious question like this? Hope you can feel the same way I feel when after enough try I can't solve a problem or understand the editorial. Hope I could answer to the downvoters some day by being RED. Are you thinking that I am joking?

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Sometimes when I can't understand editorials I just copy-paste the code and do step-debugging. It's really helps you to understand the process how it's working.

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 3   Vote: I like it +3 Vote: I do not like it

      Okay! but I will give it a try. But the codes are itself so compact..it's hard. Can you please tell me how much time should I try before looking into code or editorial? @praytic

»
9 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Somebody please give me a way to be better. I don't care about downvotes/upvotes but the answer matters. Please answer the questions and show me the way.

»
9 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I think you could read some books and learn some basic algorithms to improve your understanding. The editorial often can be hard to understand because it considers you know something about it.

Take a look at http://www.quora.com/Computer-Programming/What-are-the-best-books-on-Competitive-programming-out-there

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

My approach to grow up to expert: Just solve a lot of problems on implementation && brute force)

»
9 years ago, # |
  Vote: I like it +34 Vote: I do not like it

"I try exactly for 10-15 mins"

Are you serious? Sometimes understanding the problem statement itself takes longer than that

  • »
    »
    9 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    Yes after reading the question I usually give 10-15min. If I can solve it I code it/ get the idea. I will change..will give more time before leaving it. Please tell me the way you practice and read editorials.

»
9 years ago, # |
Rev. 2   Vote: I like it +12 Vote: I do not like it

I usually allocate a certain amount of time for each stage of problem solving. For example:

phase 1: Understanding the problem statement(15min): (if it takes longer than this I just don't even bother the problem is way above me) I usually put problems like this in a list of "come back later" where I'll read it again in a couple months.

Phase 2: Thinking phase (30 minutes) This involves just thinking of some sort of solution/approach to the problem, and if I can't even begin to approach it I stop and glance at editorial. If editorial solution is way too complicated I'll put it in my "come back later" list.

--Note: after I reach phase 2 there is no going back. I'm going to understand this problem at some point, there is no putting it in the "come back later" list, time to face it now!--

phase 3:Code-sketch (30 minutes): If I can't type a solution that I've thought of in less than this time I will assume my solution is probably not the best one considering many people can finish the problem in minutes. It may also be the case I'm lacking knowledge on a type of datastructure, or concept.

phase 4: Coding (5-10 minutes): If I can't code the solution I sketched in less than 10 minutes I obviously didn't sketch it out well, I'll usually go back to codesketch phase and if I'm stuck I'll go to editorial.

phase 5: Debugging(45 minutes): If I have a solution but it gets rejected I limit myself to 45 minutes to debug and find what I did wrong on my own. This usually annoys me, but I believe it is important to do to really embrace the problem.

Only after making it through all these stages (or getting stuck on stages 2-5) will I check the editorial. Once I read the editorial, I will do anything possible to understand the problem solution, whether it be reading books on it, watching MIT opencourse lectures on the algorithm, proving it, asking professors at my university, and more. This approach is working for me so far, but I am still a beginner myself.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Wow, thank you! This seems like a very organized and thoughtful method. I will probably adopt (a version of) these ideas in the future, for my practice. :)

»
9 years ago, # |
  Vote: I like it +5 Vote: I do not like it

"I realized that I have to solve problems to be good at this." — truly wise words from a wise man :P.

  • »
    »
    9 years ago, # ^ |
    Rev. 2   Vote: I like it -7 Vote: I do not like it

    "truly wise words from a wise man"_

    You were div-2 one day. Yes I have solved ad-hoc and number theory problems in other judges. So you tell me how do you go about it? The red's does not need to editorial I think. Stop giving sarcastic comments.

    Sorry for my bad reply..what you said is true. Thanks .

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it -7 Vote: I do not like it

      Sorry if that seemed to be rude, I didn't mean to. I just wanted to point out that this sounds like "One day I finally realized that 2+2=4" :P, nothing personal. Keep learning, competing and solving problem, I wish you high rating :).

»
9 years ago, # |
  Vote: I like it +5 Vote: I do not like it

it is very sad that top people don't bother to answer questions like this. They maybe don't know how does it feel :3

I have a very limited experience, but what the hell I will share. For question the first question I do really have this problem. However, when I'm reading editorial for some problem there are some cases. Here are what I can remember or been through till now:

1) WoW! how did i missed that! This comes when the problem just have tricky observation or a corner case that you missed and you fully understand the solution.

2) you just go through the editorial and understand what is going on. Well, don't stop there go and code that solution to 100% comprehension if you get stuck go back to the editorial or see some codes or ask.

3) you see something like "we can use BIT bla bla bla ...". Here you shouldn't even ask because it's your duty now. If you are lazy now then just forget about the problem and consider it as Above My Level , or if you insist to solve that problem you have to go and learn the new terms that it mentions. For the example above you have to go and learn BIT (also known as binary indexed tree or Fenwick tree) after you learn that, meaning that you know how does it work theoretically and know how to code such thing and solve one or two trivial problems that only require basic understanding of such knowledge, go back and take another shot trying to understand the editorial this time you HAVE to be ABLE to understand the solution if not it's whether you didn't fully understand the BIT itself or you are understanding some point and some points are too complicated so maybe the editorial is written bad so ask for those complicated points or check for them in the comments. Well, in worst cases this problem is above your level that yields you have to solve more problems and practice to be more familiar with BIT and how to convert the giving problem into something solvable using it. Sometimes the solution is about a combination of some data structures or advanced techniques that you don't know, in this case it will be hard so just ignore it till you become better.

4) this is common i think, the solution requires knowledge you are already familiar with but the way that it is all combined together is the key. in this situation it goes back to case 2.

about the second question, it of course differs from person to another and it depends on the problem you are solving. (let's go back to BIT :D) if you just learnt to code BIT and how does work and went to solve some problem. for the first few problems, in my opinion, don't bother just read the solution if the source you are learning from is good it will immediately do this for you i.e giving you an example and a plain solution. then you have to solve some problems completely by yourself if you faced a problem and get stuck (not able to solve after about 1 hour) read the solution but it doesn't count you have to try another problem until you are able to handle a problem fully by yourself. If you want to get even better try some variants here you may have to try for days (this stands for me). in another case let's say you are solving problem A from some contest, here you have to do everything you can to solve it because you have to solve such problems even if takes about an hour or just ignore it and get back later maybe you are missing something (here i am talking about getting the idea if it is about implementation you may have problem learning the programming language you are using), but in worst cases read the editorial and get it accepted. Of course for harder problems like D, E you have to spent more time and try to identify problem type and think with the knowledge you have like if the problem talks about graphs try to remember what theories and algorithms you know and how to apply them or how can they help you in this problem. when you put everything you know and can't approach the problem go read the editorial don't stick to specific time just do your best and try to approach the problem from variant ways until you have nothing left.

"graph" term may be new for you. Well, for this case you HAVE to learn basic and standard algorithms how or where, i'm sorry i'm not the right person to ask but learning the basics is enough to move on to division 1 (I am in it by chance :P)

sorry for the long writing and bad English. Hope it Helps after all :D

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I often get this case-4. Thanks for your answer. I will try my best.

»
9 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

My way is regard solving problems as climbing steps. We climb higher step by step.

I believe there are problems that can't be solved or editorial can't be understood by now. But also there are problems that can be solved after reading editorials.

So maybe these problems are the steps guiding us to solve harder problems.

Hope it can help you.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Exactly, I was thinking about it. That maybe I should emphasize more on the problems that are medium and the editorial is quite easy. Thanks

»
9 years ago, # |
  Vote: I like it +16 Vote: I do not like it

Much like solving the problems, understanding editorials is a skill that needs to be practiced. As much as it would be nice for all editorials to be written such that someone who is new to competitive programming could solve the problem from reading the editorial, the amount of background information and weird techniques required often makes this impossible for some problems. Keeping this in mind, don't expect to be able to easily understand the editorials for all D and E problems at this point. Instead, focus on problems that are just outside your ability to solve on your own. If the problems you get stuck on in contests are B problems, then solve more of those (possibly with the help of the editorial) until you reach the point that if you enter a contest, you're pretty confident that you will be able to solve the B problem in contest. Then repeat for harder and harder problems.
Also, don't be afraid to ask people questions. If you don't understand an editorial, you can either comment on the editorial and ask for clarification (from what I've seen such questions are usually answered within a day), or even message someone who solved the problem and ask them (some people might get annoyed by this or just not feel like answering so usually commenting on the editorial or making a blog post works better).

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

    Thank you very much. It helped me. I had the same doubt about how to solve stuffs. One more question.

    I've an obsession about solving pages after pages of codeforces. So I simply sorted them from most solved to least and just started from 1st and now I am at 3rd page. Am I doing right or I should change my style.

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

      It's hard to say whether a training style is right or wrong since it varies so much by person. What you descibed is exactly what I did when I was training a lot, and what I found is that it improved my speed at solving easy-medium difficulty problems, but that with the number of problems I did, I never reached the pages with very hard problems (Div. 1 C and above), so it did not help as much with my ability to solve those.

      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Can you please tell about what you did to start solving C and D in contests ??

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
          Rev. 2   Vote: I like it 0 Vote: I do not like it

          There is no such switch to click. More like: once you notice that C or D looks solvable, then once more, then you proceed to solving C every round and so on. If you spend at least some time on C/D during the round, then this moment will come.

          UPD: Of course, it will be much faster if you solve these problems at least in upsolving.

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

          I started solving them outside of contest, and if I spent more than 30 minutes on one without making good progress on it, I read the editorial and then implemented the solution. After doing this for many problems, I reached the point where I could solve most C/D problems within contest time.

          • »
            »
            »
            »
            »
            »
            8 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Thank you for your answers mkirsche and awoo

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

            Hey mkirsche and awoo I just need your assistance. I have solved about 300 or more problems and confident about Div 2 A problems and can solve Div 2 B problems but I take some time. What I felt is that I need to improve Div 2 B and go for upsolving as I felt that they(Div 2 A,B) contains maximum questions on implementation only. I have entire 2 months of vacation & I can give 6 hours a day easily as in usual days I give 3-4 hours. I had started programming seriously from 2 months nearly(although I've joined before nearly 2 years) and I am enjoying it also.

            I thought of the following options for my vacation:

            • Do 5-10 usual questions(they are easy and will only take say 1-2 hours) sorted in decreasing order of solving and then pick a topic(say graph) and solve as much as questions till you are confident and then switch topic(say number theory) but keep in touch with previous topic(graphs)

            • Keep solving as much as questions you can do in a single day and continue like that and you will reach the topics the hard way.( I kept this option because when you sort and do problems the difficulty of questions change gradually)

            • Leave the usual way of doing easy questions(may be the usual way is killing time) in reverse sorted order and continue with topics(like graphs) only

            Can you people or anyone please give your views which one you would have preferred in my situation ?

            NOTE: I am ready to put my efforts as much as possible just need of a little guidance. I am also planning for this year ACM/ICPC. If anyone can assist me it would be of great help