hdu 4421(枚举+2-sat)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4421

思路:枚举32位bit,然后2-sat判断可行性,这里给出2-sat矛盾关系构图:

1、a&b=0  :  a->~b,b->~a;

2、a&b=1  :  ~a->a,~b->b;

3、a|b=0   :   a->~a,b->~b;

4、a|b=1   :   ~a->b,~b->a;

5、a^b=0  :   a->b,b->a,~a->~b,~b->~a;

6、a^b=1  :   a->~b,b->~a,~b->a,~a->b;

http://paste.ubuntu.com/5976976/

原文地址:https://www.cnblogs.com/wally/p/3253731.html