题目描述 给出 $n$ 个赛车赛道和A、B、C三种赛车,除了 $d$ 个赛道可以使用所有三种赛车以外每个都只能使用给出的两种之一。另外给出 $m$ 条限制:某个赛道使用X则某另一个赛道必须使用Y。问:是否存在一种方案满足所有条件?输出一种合法方案。 $n]le 50000,d\le 8,m\le 1 ...
分类:
其他好文 时间:
2018-01-30 00:27:55
阅读次数:
168
POJ 3683 Priest John's Busiest Day 题目链接 题意:给定几个时间,si, ti, di每一个时间要选[si, si + di]或[ti - di, ti],问是否能选出全部时间不相交的方案 思路:显然的2-sat,注意推断相交的方法 代码: #include <cs ...
分类:
其他好文 时间:
2018-01-20 10:57:21
阅读次数:
149
2-sat 找好怎样连边即可 #include<cstdio>#include<algorithm>#include<cstring>using namespace std;const int maxn=1000000;bool mark[maxn*2+10];int age[maxn*2];int ...
分类:
其他好文 时间:
2018-01-18 20:42:03
阅读次数:
142
两天总算刷完了这六题,也算是有些收获吧。 先来说说建图的问题,之前我们可以看到都是建两条边,而这题得建四条边,为什么呢? 因为根据实际情况考虑吧他们前后都有可能。 所以在这里我们要得出结论,2-Sat题目就如同网络流,差分约束一样,根据题意给出的限制条件建图。 然后再说说这个tarjan,作用是用来 ...
分类:
其他好文 时间:
2018-01-18 20:35:37
阅读次数:
162
开始学习2-sat的姿势 http://blog.csdn.net/jarjingx/article/details/8521690 这篇文章写的真好 算法的过程如下: 构图 更具体的后面再说缩点 Tarjan算法缩点,将所有的边反过来( 为什么?后面有嗯 )判可行 枚举集合的两个元素,看其是否处于 ...
分类:
其他好文 时间:
2018-01-17 18:15:02
阅读次数:
201
题目 Up to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, ...
分类:
其他好文 时间:
2018-01-15 18:56:23
阅读次数:
185
题目 Katu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an integer c ...
分类:
其他好文 时间:
2018-01-15 14:44:58
阅读次数:
149
题目 liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such e ...
分类:
其他好文 时间:
2018-01-14 14:29:01
阅读次数:
179
STINGY SAT is the following problem: given a set of clauses (each a disjunction of literals) and an interger k, find a satisfying assignment in which ...
分类:
编程语言 时间:
2017-12-31 21:08:01
阅读次数:
211
算法概论——课后习题8.3 问题 STINGY SAT is the following problem: given a set of clauses (each a disjunction of literals) and an integer k, and a satisfying assig ...
分类:
编程语言 时间:
2017-12-30 16:59:16
阅读次数:
127