roundspecs's blog

By roundspecs, history, 3 months ago, In English

The long awaited annual contest is tomorrow:

Full text and comments »

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

By roundspecs, history, 8 months ago, In English

Since I started doing CP, I have received much advice from my friends and seniors at my university and YouTube. Some of them worked and some didn't. Here is a list of a few that worked for me and a few more that I learned from experience.

  • It's easy to solve problems that are similar to the problems you have solved before because you can solve them from memory. But always keep in mind that the main goal of CP is to invent new solutions rather than solving them from memory.
  • Don't start typing code before solving the problem on paper.
    More: The Blank Screen (Think Like a Programmer)
  • If the problem seems too difficult, instead of attacking the problem directly, temporarily reduce the complexity of the problem.
    Example: Find all occurrences of a given word in a string and replace them with another word.
    Simplified: Find the first occurrence of a given word in a string and replace it with another word.
  • After coming up with a solution, test the sample cases first, before starting to write the code.
    Reason: You might think that it's a waste of time but eventually you will get faster at analyzing the sample cases. Moreover, imagine if you come to know that your solution does not even work on the sample cases after you wrote down the entire code! Spending a little time analyzing the sample cases is far better than that.
  • During the contest, solve the problems as fast as you can. But after the contest, make sure to review the problems and try to learn from them.
    • Note down the relevant concepts and strategies.
    • Try to generalize the solution so that if you are given a similar problem, you can solve that easily.
    • Try to come up with a simpler solution
    • Make your code look elegant
  • How to ask for help:
    • Step 1: Try yourself first. Asking for help is kind of like giving up. Every problem you face is a new opportunity to learn something new.
    • Step 2: Try again
    • Step 3: Google it
    • Step 4: Ask others. Don't just send your code and ask to solve the problem. Try to describe the approach too. And don't send the link to the problem(unless they ask for it). Explain the problem in your words.
  • Disable tags for problem sets here. If you want to see the tags visit the problem link in incognito mode.
    Reason: Figuring out the topic is a skill in and of itself.
  • How to choose problems for practice:
    • Stalk someone a little better than you (preferably someone you know). Solve the problems he is solving and if you get stuck you know whom to ask for help
    • Solve random problems. Yes, you may face problems that are way out of your skills. But figuring out that you can't solve a problem is a skill that will be very handy in contests.
    • Read the editorial even if you have solved the problem
    • How to choose problem rating for practice?
      Go to your Codeforces profile and navigate to the problem rating histogram. Find the last two unequal bars between [current_rating-300, current_rating+100] and make them equal.
      N.b. Thanks to adid_r10 for pointing out in the comments that the problem rating histogram is visible only after installing the CF Analytics extension
  • Explain your approach to others. It will help you improve your ability to think. If you don't have someone to explain to, open a YouTube channel.
  • Don't use long templates
  • Always put some comments on top of the code to avoid getting skipped due to duplicate code
  • Type faster
    • Change the password of your device often, and use the letters/symbols that you think are difficult to type.
  • Learn to type concise code
  • Learn a good coding style
  • Learn discrete mathematics. Here is why:
    • Logic is defined as The study of the laws of thought, and I don't know about a subject that teaches you the laws of logic more rigorously than Discrete Mathematics
    • The main reason why I believe discrete mathematics is important for designing algorithms is that it teaches you how to prove that the algorithm is efficient and correct.
    • If you know how to prove the correctness of an algorithm, you can modify it to work on other similar situations.
    • Your intuition will grow
    • And technically, proofs are all we know. Here is a quote I read in a book:

      The statements that we have proved are called theorems. And the collection of all the theorems about a topic is what we know about that topic.

  • Learn the ins and outs of DSA. Here's why:
    • The concepts behind them are useful for solving other problems. Example: A concept of sorting algorithm, number of inversions, is sometimes helpful for solving problems that are not related to sorting
    • Better understand when to apply which DSA
  • Even though it is important to learn DSA in-depth, to solve problems that are somewhat but not directly related to a particular Data Structure or Algorithm, sometimes its easier to think of a Data Structure or Algorithm as a level of abstraction (a.k.a Black box). This means that you don't have to worry about how it works under the hood, but rather worry about how to use it. It's like using a remote to turn on the TV — you don't have to understand how the remote works to use it.

Full text and comments »

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