Dynamic Programming + Path | Codeforces Round 637 | Nastya and Scoreboard

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

Комментарии • 46

  • @takeUforward
    @takeUforward  4 года назад +10

    UPD: The solution works without the third state too.

    • @ranjanchaudhary4175
      @ranjanchaudhary4175 4 года назад

      reason?

    • @thanostapras6886
      @thanostapras6886 4 года назад

      @@ranjanchaudhary4175 You can use only the first two states (the number of the current string and the remaining sum k) by observing that by not taking into account the third one, you are still able to determine whether or not a solution exists. The only modification would be that in the recursion you would have to print the digit of the next - and not the current - element.

    • @gurharpartapdhaliwal3087
      @gurharpartapdhaliwal3087 4 года назад +1

      yeah i was also thinking the same. btw thanks very nice editorial.and if using string your sol was giving tle we could have created a global string for storing intermdte states.

  • @ganeshchowdhary3024
    @ganeshchowdhary3024 3 года назад

    DP+Path Amazing. Storing answer directly in the form of string gives TLE or MLE. But storing each digit at a particular level and traversing the dp tree to combine each digit gives AC. Superb! Any DP+Path or large output with dp or even recursion can be solved like this. Thank You!

  • @RAJ52766
    @RAJ52766 4 года назад +1

    The best solution explainer I have even seen on RUclips.
    Great job man!! Hope to see your solution always.

  • @sanyamchuriwala2107
    @sanyamchuriwala2107 4 года назад +1

    Bro, amazing solution. It was a mind-opening solution and really got the feel of how things are working. Genuine Respect.

  • @shankhashubhramukherjee3585
    @shankhashubhramukherjee3585 4 года назад +1

    Amazing explanation.... You made it look so easy..

  • @AnkitSharma-uk7mc
    @AnkitSharma-uk7mc 4 года назад +1

    Amazin explanation. Thanks man 🙏🏻 keep on the good work.

  • @vikasvishwakarma5263
    @vikasvishwakarma5263 4 года назад +3

    These type of tutorials show how beautiful teacher you are and why tech giants are hiring you brother! Thank you for amazing lectures

  • @mrityunjaymahato7203
    @mrityunjaymahato7203 4 года назад +2

    Nice Explanation...!!
    Thanks a lot.

  • @dhananjaysonawane1996
    @dhananjaysonawane1996 4 года назад +1

    Beautiful code! More beautiful explanation!!
    I request you to illustrate both bottom up and top down approach for the same problem.
    Thanks man :)

    • @takeUforward
      @takeUforward  4 года назад

      It will look more or less similar, try that once after watching my LCS video, thanks.

  • @akshaykumarmishra6535
    @akshaykumarmishra6535 4 года назад +1

    Thank you for the hard work you are putting in guiding us. #bestwishes

  • @sanukumar9032
    @sanukumar9032 3 года назад

    if in any dp if we have to trace dp path . does this will work there also ?

  • @himanshu298
    @himanshu298 4 года назад +2

    How do you make it this easy? Is that this easy? Insan guy here. Have not seen someone explain DP this easily. 👌🏻

  • @tejasghone5118
    @tejasghone5118 3 года назад

    Can we always say that whenever we reach any k==0 and i==numbers size then that will always give the max ans coz we are calculating permutation from 9 to 0 so whenever it reaches base it will always be max

  • @rohit.goyal069
    @rohit.goyal069 4 года назад +2

    Amazing explanation, just a suggest friend, try to upload when system testing has been done because sometimes there might be some border case one might not expect but find later after the testing. Rest, video is amazing!

    • @takeUforward
      @takeUforward  4 года назад +7

      Consulted with other coders too, they did the same way, then people are really motivated to know the solution right after the contest, sys test would have been done by now, had Codeforces not gone down. Anyways, if it fails, I will update the reason for so.

    • @travelinGuitarist
      @travelinGuitarist 4 года назад

      concept and approach is more important and a lot of people are eager for the solution after the contest. :D

  • @techbenchers69
    @techbenchers69 4 года назад

    Your explanation is awesome .
    Can u solve problems topic wise

  • @sainathsingineedi2922
    @sainathsingineedi2922 4 года назад +2

    Good explanation bro but try to explain problem B and C also✌️

  • @shahkushal1495
    @shahkushal1495 4 года назад

    Thankful to you, I am currently an amatuer programmer. I wish to reach some where around 1800s in codeforces. What I feel I am lacking at is dp. Please suggest some interesting sources to learn dp from.
    Thanks.

  • @rajgothi2633
    @rajgothi2633 4 года назад

    NICE EXPLANATION MAN!

  • @Anonymous-pj2mv
    @Anonymous-pj2mv 2 года назад

    Extremely awesome explaination

  • @RifatulIslam__
    @RifatulIslam__ 4 года назад

    Very helpful 😍😍😍😍

  • @omagarwal4769
    @omagarwal4769 4 года назад

    Nice logic but I have one doubt what's the use of third state, we dont need to carry the previous digit in the next recursion

    • @omagarwal4769
      @omagarwal4769 4 года назад

      also in the findans function why do u need to check sum - cnt >= 0 && cnt != -1
      instead of that only checking if dp[ind][sum][num]=1 is sufficient because that 1 ensures that we made exactly k changes by choosing this path so need to further again check those condiyions except of dp. can u pls explain is it right or wrong?

  • @keshavgupta605
    @keshavgupta605 4 года назад

    How to solve nastya and door problem ?

  • @anshumandasgupta9084
    @anshumandasgupta9084 4 года назад

    Can you please upload the solution for Nastya and the Generator?

  • @namanjain9094
    @namanjain9094 4 года назад

    I di not get about the dynamic programming part. It would be better if you just could explain that point in detail i.e how to solve and get an answer from that matrix

  • @UltraHdVideosOfficial
    @UltraHdVideosOfficial 4 года назад

    Amazing explanation bro

  • @UtkarshPandey-zm9bs
    @UtkarshPandey-zm9bs 4 года назад +1

    Nice explanation

  • @ranjanchaudhary4175
    @ranjanchaudhary4175 4 года назад +1

    what made you think greedy wont work here

    • @takeUforward
      @takeUforward  4 года назад +5

      Because it might happen that you exhaust all the sticks upfront and are left with no more after that, hence you cannot apply greedy.

    • @kushagrasahni9708
      @kushagrasahni9708 4 года назад

      Whenever the choice of greedy or dp is not being clear to you, just judge by looking at the constraints. Here O(N^2) could have passed easily.

  • @abhiraj9990
    @abhiraj9990 4 года назад +1

    I think I would suggest.Don't put hint In title.bcoz.it will ruin for ur subscriber who didn't solved that problem

  • @hackerhaddi
    @hackerhaddi 4 года назад

    love you

  • @ranjanchaudhary4175
    @ranjanchaudhary4175 4 года назад

    i dont think we need the third dimension in dp

    • @AnkitSharma-uk7mc
      @AnkitSharma-uk7mc 4 года назад

      Can you read the description please. He has mentioned it that, there can be optimisations, it is just his way in which we got AC.

  • @beingnikhil155
    @beingnikhil155 4 года назад

    codeforces.com/contest/1341/submission/107053368 getting TLE is it because of java fuckup I mean java is slow?

  • @mukulkadyan7125
    @mukulkadyan7125 4 года назад

    Its giving MLE

  • @fuad2554
    @fuad2554 4 года назад

    Hey thanks! With your help, I solved the problem. Btw I used two states. #79082796