Awesome Editorial just loved it learnt something new
Hey,
For the test case 369 428 797, can you please explain why pairs like (1,796), (2,795) … (795,2) (796,1) valid?
After all, they are obtained by shuffling some bits in A and B. Can you please point out where I am getting confused?
Thanks
"Important thing is, that If we add two bits at a position, there may be a carry forward to next bit. This means, that bit to be chosen at the next significant position is dependent on carry-forward from the previous position. This means, that we have to approach the bits from least significant bit to most significant bit.
So, Suppose we need to have a bit at current position to be x, with carry-forward cf from the previous position.
If x is same as cf, We can either have the current bit set in both numbers or none of them. Because if we choose to have set bit in exactly A or B at the current bit, the current bit will get flipped, resulting in A+B≠C.
If x is not same as y, we have to flip the current bit, which can be done only if exactly one of the A or B have current bit set, which will lead to flipping the current bit."
@taran_1407 @vijju123 can you please explain these bunch of statements with an example.
This solution is showing runtime error(sigtstp)
I think its because of declaring such big array.
Its having time complexity of O(10^9).
What is the brute force approach that would solve one sub task?
@taran_1407 In recursive function, if we add an extra condition bit_a==0 && bit_b==0 return 0;
produces WA. Can anyone explain the reason?
Again… XD
Fun Fact - @l_returns is the first person to comment on this answer.
Mega Fun Fact - @tarini_1407 and @taran_1407 study in same college.
So @taran_1407 you have got one teammate. Search reduced to finding one more. xD
Fun fact 3 - This statement is worth reading. CodeChef: Practical coding for everyone
I guess @taran_1407 has a huge female fan following in his college
I expect one of my friends is pulling this prank on me. As far as I know, There is no Tarini in my college.
So, teammate search continues.
lol. Someone using his powers.
Click to view
Click to view
Thats because it will spam the editorial. 1-2 jokes are fine but that answer simply opens up a new road to spam more and more XD. I dont have issues of it using my name, but the fact that it will spam the editorial unnecessarily - I consulted taran also before removing it.
Hi @vijju123,
Please don’t disappoint me and you can convert my answers into a comment on @tarini_1407 answers. Sadly, I don’t have powers to do so.
There is no Tarini in my college.
lol. You have searched your college database?
XDDDDDDDDD
@aryanc403 - @taran_1407 knows everything about girls in his college, as evident from his statement
@vijjji123 - Sadly there, there is only disappointment from me in your fate. I wont be writing editorials for a long, long time XD.
@ everyone
I just hope next time you all will read my comment carefully. I explicitly mentioned “As far as I know” xD
All of these pairs are not valid.
For verification, write a brute program which iterates over all pairs of (i, c-i) and count the number pairs in which i have same bit count as a and (c-i) has the same bit count as B.