/**
给出图中的每条边的关系 a op b = c, op(AND,OR,XOR)
问这个图是否符合逻辑(结点取值0或1)
把结点x拆成x0和x1两个,则转化为2-sat
例如,op == AND时,
若c == 0,矛盾的对为 (a1,b1)
若c == 1,矛盾的对为,(a0,b1) (a1,b0) (a0,b0),
此情况下没必要建出六条边,观察得只要建边 a0 -> a1,b0 -> b1即可
*/
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
#define N 2000
vector<int> vec[N];
int id[N],pre[N],low[N],s[N],stop,cnt,scnt;
void tarjan(int v,int n)
{
int t,minc = low[v] = pre[v] = cnt ++;
s[stop++] = v;
vector<int>::iterator it;
for(it = vec[v].begin(); it != vec[v].end(); ++it)
{
if(-1 == pre[*it])
tarjan
poj 3578 katu puzzle #2-sat
最新推荐文章于 2019-11-15 21:46:15 发布