Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Shayan's blog

By Shayan, 3 hours ago, In English

Hi,

Today, I had my first topic stream on Dynamic Programming. The stream lasted for two hours, and this was the plan for the first livestream:

  1. Start with the basics of Dynamic Programming: the logic behind it and when to apply it.
  2. Boredom — difficulty 1500
  3. Consecutive Subsequence — difficulty 1700
  4. Red-Green Tower — difficulty 2000
  5. Winter is here — difficulty 2200

I will write the highlights of the livestream here, while embedding the specific parts of the videos so that you can easily watch the parts you want. You can ask questions about any part here, on YouTube, or in our Telegram Channel. The main discussion thread is in our Telegram Channel.

The Basics of Dynamic Programming

In this part, I talk about what Dynamic Programming is and why we might want to use it. I explain how to figure out if we can apply DP to a problem. Of course, as an example, I discuss the Fibonacci sequence—who doesn’t use Fibonacci when explaining DP? I tried to skip unnecessary details and keep the focus on the most important points.

455A — Boredom

This problem helps to build intuition on how DP works. It’s an example of defining states and solving the main problem using those states. In this case, we define dp[i] as the answer when considering only the numbers from 1 to i and ignoring the rest.

Video

977F — Consecutive Subsequence

This is another problem that helps with the idea of defining subproblems as the different cases that contribute to our final answer. Here, we define dp[i] as the answer if the last chosen number in our subsequence is i.

Video

478D — Red-Green Towers

This problem combines a greedy algorithm to find the best value for h and defines subproblems like (i, j). This states how many ways we can have a pyramid of height i using j red blocks.

Video

839D — Winter is here

This one features number theory. We want to find the value of dp[x] as the number of possible subsets whose GCD is x. To do this, we first find the number of subsets where one of their common divisors (not necessarily the maximum one) is x. From there, we determine the number of subsets whose GCD is x.

Video

Let me know your opinions! This is your livestream, and together we can make it better.

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

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you so much for doing this.

»
118 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Thank you so much, this is really helpful for me cause i often struggle with DP problem...

»
93 minutes ago, # |
  Vote: I like it -20 Vote: I do not like it

Shayan, FYI: I feel disgusted and annoyed when I see my problem used by multi-account user and scammer like you. Would be great if you exclude it from your post, I don't want to be associated with you in any way.

  • »
    »
    73 minutes ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    I mean, he did apologize, and also doesn't use his other account, and also provided the full details about what happened, and in my understanding, it was just a misunderstanding and a rookie mistake since it was his first time doing something like this, maybe he deserves to be forgiven?
    still ur choice.

    And he also seems like he's being a good guy and actually trying to make good use of his yt channel and teach stuff.

    We all make mistakes, maybe even on purpose, but we can change, and we can be better ppl, if the whole world acted like u, how could someone recover from a mistake they made months ago; giving him another chance won't harm anyone, rather may benefit ppl, be nice bro, it won't do anybad

  • »
    »
    69 minutes ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    I’m not the person you think.

    I don’t have multiple accounts. I used to have Algorithms_with_Shayan, and Mike wanted me to abandon it, so I did. Since then, I have not used any account other than this one, and you cannot find any login with my IP.

    Regarding the accusation of scamming, I don’t want to complain about why you say such a thing to me. Instead, I want to ask you and anyone else against me to please open this matter. Let me know what I have done incorrectly. I agree that having Algorithms_with_Shayan along with Shayan was against the policies (at that time, I thought maybe it could be considered like atcoder_official or something similar, but it wasn’t right, and my YT channel was not atcoder). But I don’t see that as enough to be called a scammer. I must have done worse things as well. Please let me and others know about the wrong things I have done. You can write another blog post against me or anything you prefer. I believe these things must be discussed in public.

    Sorry for using your problem, I didn’t see this issue coming. I have already discussed this one and I am not going to remove it. But I’ll try to avoid using any problem authored by you in the future.

    And sorry for making you disgusted and furious. You might not believe it, but I am truly sorry for that, and if you let me know what I did incorrectly, I can stop that.

    • »
      »
      »
      63 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      it's a mistake you made, if u do it a second time, it's a decision and deserves punishment, but as akasakaR said, u don't look like a guy who just scams ppl and stuff, u look like u actually enjoy this yt thing and put a lot of effort into this, and it's a mistake u made one day, everyone make mistakes, the only thing u need to know is not to make that mistake again and do ur abs hardest. just this :)

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

    bro what do you even mean he disbanded his other account for a long time and uses his original account and for your information this problem is not private anymore because it's on a public platform and it's public now so I assume everyone can use it and do you have anything that says he's a scammer.Shayan is one of the people who is benefiting himself by help others.

»
31 minute(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for the stream, helped a lot!