摘要: 1 /** 2 *2-SAT模板,Modified Edition of LRJ 3 *输入:按照法则添加边(参数为2*i或者2*i+1) 4 *运行:先init(n),再add(),再solve() 5 *输出:mark[](1表示选中),solve()(是否有解) 6 */ 7 const int maxn = 0; 8 struct TwoSAT 9 { 10 int n; 11 vector G[maxn*2]; 12 bool mark[maxn*2]; 13 int S[maxn*2], c; 14 15 bool df... 阅读全文
posted @ 2013-08-14 16:55 xysmlx 阅读(222) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3622对半径进行二分,如果冲突则加入边(按照X AND Y == 0的法则插入边),再2-SAT即可。 1 //#pragma comment(linker, "/STACK:102400000,102400000") 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 1 阅读全文
posted @ 2013-08-14 16:31 xysmlx 阅读(225) 评论(0) 推荐(0)