Help needed in Google APAC 2016 Round E problem C
Разница между en4 и en5, 0 символ(ов) изменены
The problem is [Google APAC 2016 Round E Problem C](https://code.google.com/codejam/contest/8264486/dashboard#s=p2)↵

I can't understand the problem in my solution described below↵

We can create a tree and then find the pattern as follows:↵
![ ](http://codeforces.com/predownloaded/5a/7e/5a7eac1d5d4ee0bde51dcd1f35d1ddcd35224d83.png)↵

As can be seen above, there are only 8 possible numbers (not necessarily distinct) shown below:↵
{0, x, x&k, x|k, (∼x)&k, x&(∼k), x^k, k}↵
(where ∼n represents bitwise negation of n; and all operators have their usual meanings)↵

So we can create a transition table for each of these numbers for each of the possiblities of AND, OR, XOR.↵
Using this logic I arrived at [this solution](http://ideone.com/y1dsQj)↵

But my program is giving incorrect answer. Can someone point out the flaw in logic and/or implementation, please.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский yashv 2016-01-31 22:06:32 0 (published)
en4 Английский yashv 2016-01-31 22:05:56 124 Tiny change: 'rd#s=p2)\nI can't ' -> 'rd#s=p2)\n\nI can't '
en3 Английский yashv 2016-01-31 22:03:11 134 Tiny change: '(where n' represent' -
en2 Английский yashv 2016-01-31 21:57:40 564
en1 Английский yashv 2016-01-31 16:34:00 167 Initial revision (saved to drafts)