/**
裸地2-sat问题。关键在于找到其中的矛盾关系。
一个圈上n个点,要连m条边,要求边只能连在圈内或圈外,且边与边不能相交。
把每条边拆成两条,圈内一条,圈外一条,
则两条边的矛盾关系存在于两条边可能相交时。即e1(a,b),e(c,d)
若 a < c < b < d 或 c < a < b < d,e1与e2必然一个在内,一个在外,即同时在内/外的矛盾
*/
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
#define N 1000
vector<int> vec[N];
int id[N],pre[N],low[N],s[N],stop,cnt,scnt;
int e[N][2];
void tarjan(int v,int n)
{
int t,minc = low[v] = pre[v] = cnt++;
vector<int>::iterator pv;
s[stop++] = v;
for(pv = vec[v].begin(); pv != vec[v].end(); ++pv)
{
if(-1 =&