The distributive property of AND over XOR doesn't hold in general. However, since we are using 2^i here(in F), thats why we are able to perform XORs of all y's followed by multiplying with 2^i. If this is correct, can you help me to prove it or please correct me if I am wrong.
@kotatsugame15 күн бұрын
Where does the AND operation appear? I wasn't sure where you were referring to specifically. Are you sure you want to show XOR_y(y*2^i+k)=XOR_y(y)*2^i+XOR_y(k) in problem F?
@ashishchokhani908415 күн бұрын
@@kotatsugame Sorry, Nvm. I was thinking * as AND operation. However, now it makes sense why the distribution holds because k<2^i. I meant that instead of 2^i, if we would have any other number x, we can't always separate y*x from y right? Thanks for the explanation!!
@kotatsugame15 күн бұрын
@@ashishchokhani9084 Yes, that's correct. Now multiplying by 2^i is the left shift operation, and adding k is the OR operation.
Can you please explain thought process behind adding (need >= 2e9) condition at 23:00 minute ?
@kotatsugame3 ай бұрын
In this code, all vertices in the subtree of vertex u, including in particular vertex u itself, must have the value >= need. Therefore, if need > max(a), there is no way to satisfy this condition.
@sxzz53 ай бұрын
@@kotatsugame Oh I see, thanks a lot.
@sxzz53 ай бұрын
Can i ask a follow up if its okay ? Shouldn't the dfs automatically return false when it eventually reaches leaf node for these need > max(a) cases ? If yes, why do we require the extra condition (after G[u].empty() check) ? I read some comments on CF that this has something to do with dealing with overflows, but can't understand exactly why or how ? Or maybe reason is different.
@kotatsugame3 ай бұрын
@@sxzz5 For each level down the tree, the value of need roughly doubles (consider the case where all a's are 0). This would immediately cause an overflow, and the condition at the leaf would be misjudged.
@sxzz53 ай бұрын
@@kotatsugame This explains it very well. Got it finally. Thanks again.
@ashishchokhani90843 ай бұрын
Hey, if possible, can u write in English, we can use subtitles for translation of audio but its difficult to understand the text. The way u explain is truly appreciable.
@seraph10073 ай бұрын
no bro hes participating in contest, go learn japanese
I genrally read your solution's for ABC -C problems , the way you write code is pretty concise and simple for me to understand.(Begginer here :{ ) THANK YOU @kotatsugame.