摘要: 2-SAT水题,还wa了好几次,可见本菜更水。。。课件上都有讲解。。。渣代码:View Code #include <iostream>#include <cstring>#include <cstdio>#include <stack>using namespace std;const int N = 2012;const int M = 1000000;struct node { int to; int next;} g[M];int head[N], scc[N];int dfn[N], low[N];int t, ind, cnt;boo 阅读全文
posted @ 2012-02-15 19:38 AC_Von 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 重点是怎么建图,纠结了一天看2-SAT的资料...a 表示1, a'表示0,则:1、a and b = 1, a' -> a, b'-> b (a b 同时为1 )2、a and b = 0, a -> b', b -> a' (a b 不同时为1)3、a or b = 1, a' -> b, b' -> a (a b不同时为0)4、a or b = 0, a -> a', b -> b' (a b同时为0 同1)5、a xor b = 1, a -> b', 阅读全文
posted @ 2012-02-15 11:00 AC_Von 阅读(552) 评论(0) 推荐(1) 编辑