hdu1824Let's go home

链接:http://acm.hdu.edu.cn/showproblem.php?pid=1824

题意:中文题。

分析:处理清楚题目所说的逻辑关系就是一个基础的2-sat问题了。

代码:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
const db eps=1e-5;
const int N=6e3+10;
const int M=3e4+10;
const ll MOD=100007;
const int mod=1000000007;
const int MAX=1000000010;
const double pi=acos(-1.0);
struct twosat {
    int n,k,d[N];
    bool mark[N];
    int tot,u[N],v[M],pre[M];
    void init(int a) {
        n=a<<1;tot=0;
        for (int i=0;i


你可能感兴趣的:(online,judge,Hdu,图论,2-SAT)