Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя brdy

Автор brdy, история, 8 лет назад, По-английски

Hello guys, if you analyze a lot of past codeforces problems in div2 you can notice knowledge of standard algorithms/ds is useful but not necessity. That segment tree solution can be done with set, or with prefix sum style sweeping.

Actually the most important "algorithm" in these problems is using your brain as someone said here.

That is why I want to ask the community for some great ad-hoc problems that have made you think/taught you important concepts or observations. (For example, you can add X to a set of numbers in O(1) by keeping global variable) I think these skills of making observations/simplifying the problem/looking at the problem from different angles is something me and many other coders are lacking, and it would especially help someone like me who is good at standard stuff but quite lacking in problem-solving skill.

  • Проголосовать: нравится
  • +100
  • Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I really enjoyed solving 279C. It taught me how the cumulative sum technique (which is very common in ad-hoc from my experience so far) can be used to solve problems which may otherwise TLE with bruteforce methods. There is no editorial either, so that was an incentive for me to try it.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится -34 Проголосовать: не нравится

Finally! A sensible question.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I have found many of these kinds of questions on AtCoder.

I shall provide a few samples.

Modulo Summation

Insertion

Takahashi's Information

Five Five Everywhere

A CF question —

Petya and Friends

This list isn't intended to be exhaustive. Most C-D level problems fall under this category. Very rarely they require knowledge of advanced data structures or algorithms. Most of the problems I sent above need quick observations.

I have also provided posts for all the above problems which you can find via this index. :)

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +35 Проголосовать: не нравится

Upvoted for tags

»
8 лет назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится

Start solving the most solved questions in the problem set by applying the filter. I solved about 100 of them and now I'm a little bit confident about solving div2B questions. You could see from my graph that earlier I struggled so much even to reach 1200. Now I'm somewhat confident of staying in green at least.

  • »
    »
    8 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +12 Проголосовать: не нравится

    As someone who started gray (not on this account, my embarrassing past account :c ) because they barely know how to code and now is stable blue (hoping to be purple soon) I can say that I have done something similar (solved dozens of usaco problems, then past codeforces problems on my weakness) and it has made a big difference, but this sort of systematic preparation (at least for me) only marginally increased my ad hoc abilities. This is especially because I grouped my weaknesses "topic-wise" (standard topics) and because many USACO problems lend themselves to the same topics (graphs/tree, data structures, dp) again and again.

    But what about problem-solving skill? What about making observations, or being creative? I know people who make div1 when they knew far less about standard algorithm + data structure from me. Some people say well "they are smarter" or "brain structure" but it's not too difficult to realize brain structure is a result and not just a cause.

    So god damn it I need some good ad hoc problem, not just this advice of "solve more problem" which I am already doing.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

https://mirror.codeforces.com/contest/91/problem/B

This is one I solved very recently while climbing the A2OJ D ladder. I reflexively went for the segment tree solution, having a gut feeling that there was a simpler solution but not taking the time to think of it. There's a much more elegant solution involving one of the most simple algorithms.

Another problem: find the number of inversions of an array (not necessarily a permutation). The classic way I hear about people doing this (and the way I would do it myself) was value compression + fenwick tree. I recently came across a much more elegant solution in a Quora answer that (again) appeals to a very simple algorithm: https://www.quora.com/Why-should-competitive-programmers-know-about-sort-algorithms-when-in-contests-we-use-std-sort/answer/Jonathan-Paulson

  • »
    »
    8 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you for sharing!

    I've always liked the idea that you can solve inversions (basically a problem asking how "sorted" the array is) by sorting itself. For inversions, it was because I was told I could use mergesort that I was able to figure it out that you can count the inversions between merges (and by viewing the mergesort as a mergesort tree you can see for a position i it considers all inversions < i).

    But what about non-standard "sort" problems.

    For example, this: http://usaco.org/index.php?page=viewproblem2&cpid=837

    The model solution is BIT, but can this also be solved by modifying/analyzing some nlogn sorting method?

    Just a food for thought.