Codeforces Div2E: DP with Bitmasking

Sdílet
Vložit
  • čas přidán 13. 09. 2024
  • Hi Everyone!
    I hope you all are doing well and enjoying the bitmasking series.
    Let's take the difficulty level up a notch.
    I'll discuss a problem named Fish that comes from a Codeforces Divison 2 round and is the problem E of that round.
    Problem link: codeforces.com...
    Enjoy watching!
    If this helped you make sure to hit the like button and subscribe if you still haven't subscribed for more quality content!
    Super useful books for algo ds and programming fundamentals!
    1. Introduction to Algorithms by Cormen: amzn.to/35AmQqu
    2. The Algorithm Design Manual: amzn.to/2K9RGPq
    3. Fundamentals of Data Structures in C++: amzn.to/2LCwIsN
    4. Object-Oriented Programming by E Balagurusamy: amzn.to/2Xxmdtr
    5. Head First Java: amzn.to/39kb44K
    6. Cracking the coding interview: amzn.to/3iDOHLK
    7. Database System concepts: amzn.to/3pisuFQ
    8. Operating Systems: amzn.to/39fcmis
    9. Discrete Mathematics: amzn.to/2MlgCE6
    10. Compiler Design: amzn.to/3pkYvx2

Komentáře • 66

  • @LeoLeo-nx5gi
    @LeoLeo-nx5gi Před 4 lety +69

    Most utubers keep doing the known famous dp related problems , u are doing something which is difficult and unique problems and also on top it's DP !!!!!!! , love it , keep doing it , most of us are eagerly waiting for such good DP problems explanation :)

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety +6

      thankyou!

    • @rahulkhandelwal7034
      @rahulkhandelwal7034 Před 2 lety

      Exactly , Kartik sir is dope in all kinds of dp whether it is digit dp , bitmasking , dp on trees .
      Kartik bhaiya pls make more videos of dp ( from all topics ) ..
      Loved ur videos btw 🤩🤩

    • @LeoLeo-nx5gi
      @LeoLeo-nx5gi Před 2 lety

      Wow am just back at this message after a year and I can see almost 50 likes, amazing, seems like it's really time Kartik bhaiya pls come back

  • @AlgosWithKartik
    @AlgosWithKartik  Před 4 lety +32

    Space Complexity: O(2^N)
    Time Complexity: O(N^2 * 2^N)

    • @nitindwivedi4074
      @nitindwivedi4074 Před rokem +1

      Why not the Time Complexity is O(N^3 * 2^N), as far as I am calculating, the solve function(bitmask DP function) is of O(N^2 * 2^N) and we have to calculate for all 'i', so the overall Time Complexity for that, might be O(N^3 * 2^N) ?? Can you explain how it's O(N^2 * 2^N) ?

  • @vibekdutta6539
    @vibekdutta6539 Před 4 lety +17

    You make DP problems seem so easy, the way you explain is so clear, thanks

  • @stayInTheGreen_
    @stayInTheGreen_ Před 4 lety +6

    this guy never fails to surprise the audience

  • @vaibhavsethia70
    @vaibhavsethia70 Před 3 lety +1

    Didn't understand completely in 1st time. But watched again and tried writing dp states and transitions along with video and understood completely. Thank you for your efforts in teaching🙏

  • @indraneelkaranam2689
    @indraneelkaranam2689 Před 3 lety +2

    After each and every video, i am becoming a bigger fan of you! Explanation at its Best!!!!

  • @nafimulyo9739
    @nafimulyo9739 Před 5 měsíci

    you know what? I love your channel so much! It helps me so much to understand these kinds of topics. Please, keep going. There are a lot of people who waits you, including me

  • @piyushsaxena6243
    @piyushsaxena6243 Před rokem +1

    You explain these hard problems so perfectly that they seem so easy, thanks a ton, big brother 💙❤️

  • @AvinashKumar-pb2op
    @AvinashKumar-pb2op Před rokem +1

    This is called real CP content 🤩. Thank you.

  • @taivinh1986
    @taivinh1986 Před 3 lety +1

    your explanations have given me deep insights in the dp, I have recommended you to my friends and teachers as well, hope you will make more videos like this

  • @ParitoshPotukuchi
    @ParitoshPotukuchi Před 3 lety +2

    I solved the question in my mind before you started explaining it. You're explanations are that awesome....😀

  • @devsharma8290
    @devsharma8290 Před 3 lety +1

    Sir please never stop making videos on such topics and also I have a request for you to cover matrix exponentiation as well.

  • @jaskeeratsaluja8590
    @jaskeeratsaluja8590 Před 2 lety

    Thanks for the video. concept is much clearer now.

  • @ManishKumar-no2ek
    @ManishKumar-no2ek Před 4 lety +1

    Great.
    will be waiting for next video.

  • @rishabhmishra9611
    @rishabhmishra9611 Před 3 lety

    You way of explaining things is awesome🔥🔥keep making these awesome videos

  • @satyarthpandey2941
    @satyarthpandey2941 Před 3 lety +1

    gold content!

  • @whyvpa
    @whyvpa Před 4 lety +2

    Sir ek video roadmap pe bana dijiye...kaise koi sirf div2a problem solve krne se lekar div2 ki saari problems solve krne tk jaa skta hai..

    • @classcure9769
      @classcure9769 Před 4 lety +1

      Bro watch this ......................nice roadmap + preparation strategy...........
      czcams.com/video/zZOQVLll9u4/video.html

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety

      Try krrta hu bro jaldi hi banane ki

  • @shashwattripathi759
    @shashwattripathi759 Před 4 lety

    awesome video dude,loved it!

  • @shivamjalotra7919
    @shivamjalotra7919 Před 4 lety +1

    Thanks man.

  • @farhadjaman5580
    @farhadjaman5580 Před 2 lety

    hello sir,at first i want to say thanks for creating this playlist,its helping a lot to learn bitmasking.I have a question I didn't understood the part why you summed all the probability at 6:33 sec.Always I didn't understood why you multiplied prev_day with p_move.

  • @satya1067
    @satya1067 Před 3 lety +2

    ❤️❤️

  • @ankushgupta630
    @ankushgupta630 Před 3 lety

    Please 2 more problems to the set or give 4-5 problems which use dp with bitmask in easy , medium and hard difficulty

  • @gauravbairagi209
    @gauravbairagi209 Před rokem

    great video.....

  • @sudhanvasavyasachi2525

    did not undertaand kc2 . please could u explain sir

  • @ajr1791ze
    @ajr1791ze Před 4 lety

    Awesome solution. Can you please share some good tutorials on probability. I am familiar with basics but want to learn probability in advance for competitive programming pov.

  • @Jerry-fy2gc
    @Jerry-fy2gc Před 3 lety

    The things is how would I know that we should go with 1-d DP or 2-D dp. Here you're using 1-d dp. But max dp with masking have 2-d dp.

  • @dragosc8202
    @dragosc8202 Před 3 lety

    You are my savior :)

  • @cse_33_ayandutta48
    @cse_33_ayandutta48 Před 2 lety

    In pmove () function why u consider jth set bit because it has to loose

  • @vaalarivan_p
    @vaalarivan_p Před rokem

    3:10 - 13:18

  • @p.adityakumar1762
    @p.adityakumar1762 Před 4 lety +1

    Sir, will you be uploading more questions on dp with bitmasking??

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety +1

      Yess I will.
      Already planned 2(solved 1), Currently a bit involved in other work.
      Will try to add soon :)

  • @akanshkumar2876
    @akanshkumar2876 Před 3 lety

    could you suggest some more problems to solve to cover more varieties

  • @piyushagarwal9347
    @piyushagarwal9347 Před rokem

    can anyone please provide me the full solution, I am getting wrong answer. I also checked code from the video still getting wrong. Printing 0 every time. Please help.

    • @AlgosWithKartik
      @AlgosWithKartik  Před rokem

      Check for my submission on codeforces for this problem.

  • @classcure9769
    @classcure9769 Před 4 lety +1

    Kartik Sir.....here is a request ....sir please make a series of videos on DSU(disjoint set Union) as i felt your dp series very interesting if you make videos on these concept it will be great ................... or please share some good resources to learn DSU........................ i am fully enthusiastic in learning this concept i have also seen some videos but all them were quite basic level or boring.......hoping for a reply
    BTW nice explanation it was a nice problem

    • @pleasesirmorevideos4684
      @pleasesirmorevideos4684 Před 4 lety +1

      DSU is easy you can learn it from hackerearth and by solving their easy questions

    • @classcure9769
      @classcure9769 Před 4 lety +1

      @@pleasesirmorevideos4684 sir i need some advanced level content........... you can search on youtube there is nothing that special ............. i am currently studying Dsu and trying problem on hacker earth ....yes easy ques are doable but many times i stuck on problems of diff >1700 on codeforces ...their tag may contain DSU but editorial does not have a dsu solution..sometimes comment section helps me but it is not for always .....also i am finding Dsu quite interesting topic ..................it will be good if you just share some resources to learn DSu quite well

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety +1

      I will try to make for that but it will take some time

    • @classcure9769
      @classcure9769 Před 4 lety +2

      @@AlgosWithKartik no problem ....until that please share links of some good resources for dsu....

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety +1

      @@classcure9769 try codeforces blogs

  • @progamerzzz1237
    @progamerzzz1237 Před 3 lety +1

    DED

  • @BizInsightHub1
    @BizInsightHub1 Před 7 měsíci

    @AlgosWithKartik please help its giving tle on 4th case idk why
    //#define prD(x) cout

  • @doforget399
    @doforget399 Před 3 lety

    Sir, please ye videos Hindi me bhi bna do..

  • @p.adityakumar1762
    @p.adityakumar1762 Před 4 lety

    Sir, are you going to upload the solutions of codeforces round 660 div2 solutions?

  • @devendrasingh4776
    @devendrasingh4776 Před 4 lety +1

    Still not able to understand 😢. What should i do

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety

      Did you try the other problems in the Bitmasking playlist?

    • @devendrasingh4776
      @devendrasingh4776 Před 4 lety +1

      Yup i solved assign problem on spoj myself after i watched your video. I think i lack probability part here.
      Previous day, premask and all egde corner i still cant visualise it

    • @AlgosWithKartik
      @AlgosWithKartik  Před 4 lety +3

      Hmm try out a few lectures on probability and expected value which might be beneficial :)

  • @yashgupta2444
    @yashgupta2444 Před 4 lety

    I repeat, Kartik Arora is GOD.