The approach for Problem C only works when there are only powers of 2 present in multiset and not anything else. So, we cannot use this approach in the scenario where there are numbers in the multiset other than powers of 2. For eg. - Let us take multiset has 4 6 7 Value to form = 10 Then the algorithm would take 7 first & the remainder would be 3 which is not present. But as we can see the sum 10 can be formed using 4 & 6. Is this correct ? Please confirm.
Please fill the feedback form for PCD : forms.gle/m6ceMbmudWyEZWWb8
the recorded editorial is way better than a live meet ......
please keep it going
Thanks for the feedback
Crystal clear Explaination
Thank you
Really loved the implementation of Q1...
Thank you
Very simple editorial.. thanks!
You are welcome 🤗
The approach for Problem C only works when there are only powers of 2 present in multiset and not anything else. So, we cannot use this approach in the scenario where there are numbers in the multiset other than powers of 2.
For eg. -
Let us take multiset has 4 6 7
Value to form = 10
Then the algorithm would take 7 first & the remainder would be 3 which is not present. But as we can see the sum 10 can be formed using 4 & 6.
Is this correct ? Please confirm.
We are being given in problem that we will add only powers of 2 into the multiset
Brilliant!
Almost , had the C😢
don't worry if you couldn't crack it during contest, just upsolve and try to find out the reason why you couldn't solve it during contest
it helps me a lot
Glad to to see that
In problem C, can you explain exactly why a greedy approach works here ?
I think a super important detail here is that this greedy approach only works because all subsequent elements are divisible by the previous element
Please discuss D and E also
I couldn't solve D and E during contest 🥲
What's the problem of solving it using subset sum dp
It will Timeout
The constraints are pretty high for subset sum dp
i also done B question with this method but my code was long, nice code of B question
#include
using namespace std;
void fun(){
string s;
cin>>s;
long long int n = s.length();
string t="";
long long int o1,z1,o2,z2;
for(long long int i=0;iz1)
break;
}
cout
Happy to see that the video was helpful 😊
Was this contest unrated?
It was rated for div 2