/**
纯裸2-sat。
贴个tarjan的模板。
*/
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
#define N 2004
#define V 1000000
int e,pnt[V],head[V],nxt[V];
int nn,id[N],pre[N],low[N],s[N],stop,cnt,scnt;
vector<int> vec[N];
void addEdge(int u,int v)
{
pnt[e] = v;
nxt[e] = head[u];
head[u] = e++;
}
void tarjan(int v,int n)
{
int t,minc = low[v] = pre[v] = cnt++;
s[stop++] = v;
for(int i = head[v];i != -1; i = nxt[i])
{
if(-1 == pre[pnt[i]])
tarjan(pnt[i],n);
if(low[pnt[i]] < minc)
minc = low[pnt[i]];
}
if(minc < low[v])
{
low[v] = minc;
hdu 3062 party#2-sat
最新推荐文章于 2023-02-17 10:17:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)