@@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.
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.
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!
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
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!
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.
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.
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?
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
UPD: The solution works without the third state too.
reason?
@@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.
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.
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!
The best solution explainer I have even seen on RUclips.
Great job man!! Hope to see your solution always.
Bro, amazing solution. It was a mind-opening solution and really got the feel of how things are working. Genuine Respect.
Amazing explanation.... You made it look so easy..
Amazin explanation. Thanks man 🙏🏻 keep on the good work.
These type of tutorials show how beautiful teacher you are and why tech giants are hiring you brother! Thank you for amazing lectures
Nice Explanation...!!
Thanks a lot.
Beautiful code! More beautiful explanation!!
I request you to illustrate both bottom up and top down approach for the same problem.
Thanks man :)
It will look more or less similar, try that once after watching my LCS video, thanks.
Thank you for the hard work you are putting in guiding us. #bestwishes
if in any dp if we have to trace dp path . does this will work there also ?
How do you make it this easy? Is that this easy? Insan guy here. Have not seen someone explain DP this easily. 👌🏻
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
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!
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.
concept and approach is more important and a lot of people are eager for the solution after the contest. :D
Your explanation is awesome .
Can u solve problems topic wise
Good explanation bro but try to explain problem B and C also✌️
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.
NICE EXPLANATION MAN!
Extremely awesome explaination
Very helpful 😍😍😍😍
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
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?
How to solve nastya and door problem ?
Can you please upload the solution for Nastya and the Generator?
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
Amazing explanation bro
Nice explanation
what made you think greedy wont work here
Because it might happen that you exhaust all the sticks upfront and are left with no more after that, hence you cannot apply greedy.
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.
I think I would suggest.Don't put hint In title.bcoz.it will ruin for ur subscriber who didn't solved that problem
love you
i dont think we need the third dimension in dp
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.
codeforces.com/contest/1341/submission/107053368 getting TLE is it because of java fuckup I mean java is slow?
Its giving MLE
Tested solution at description
Hey thanks! With your help, I solved the problem. Btw I used two states. #79082796