POJ 3905 Perfect Election
题目链接
思路:很裸的2-sat,就根据题意建边即可
代码:
#include
#include
#include
#include
#include
using namespace std;
const int MAXNODE = 2005;
struct TwoSet {
int n;
vector ...
分类:
其他好文 时间:
2014-10-27 01:46:37
阅读次数:
183
POJ 3207 Ikki's Story IV - Panda's Trick
题目链接
题意:一个圆上顺序n个点,然后有m组连线,连接两点,要求这两点可以往圆内或圆外,问是否能构造出使得满足所有线段不相交
思路:2-sat,判断相交的建边,一个在内,一个在外,然后跑一下2-sat即可
代码:
#include
#include
#include
#include...
分类:
其他好文 时间:
2014-10-26 19:46:35
阅读次数:
199
POJ 2296 Map Labeler
题目链接
题意:
坐标轴上有N个点,要在每个点上贴一个正方形,这个正方形的横竖边分别和x,y轴平行,并且要使得点要么在正方形的上面那条边的中点,或者在下面那条边的中点,并且任意两个点的正方形都不重叠(可以重边)。问正方形最大边长可以多少?
思路:显然的2-sat问题,注意判断两个矩形相交的地方,细节
代码:
#include...
分类:
其他好文 时间:
2014-10-26 18:27:39
阅读次数:
125
HDU 1816, POJ 2723 Get Luffy Out
题目链接
题意:N串钥匙,每串2把,只能选一把,然后有n个大门,每个门有两个锁,开了一个就能通过,问选一些钥匙,最多能通过多少个门
思路:二分通过个数,然后对于钥匙建边至少一个不选,门建边至少一个选,然后2-sat搞一下即可。
一开始是按每串钥匙为1个结点,可是后面发现数据有可能一把钥匙,出现在不同串(真是不合理...
分类:
其他好文 时间:
2014-10-26 13:10:14
阅读次数:
140
HDU 1815, POJ 2749 Building roads
题目链接HDU
题目链接POJ
题意:
有n个牛棚, 还有两个中转站S1和S2, S1和S2用一条路连接起来。 为了使得任意牛棚两个都可以有道路联通,现在要让每个牛棚都连接一条路到S1或者S2。
有a对牛棚互相有仇恨,所以不能让他们的路连接到同一个中转站。还有b对牛棚互相喜欢,所以他们的路必须连到同一个中专站。
...
分类:
其他好文 时间:
2014-10-26 11:46:02
阅读次数:
399
HDU 3715 Go Deeper
题目链接
题意:根据题意那个函数,构造x数组,问最大能递归层数
思路:转化为2-sat问题,由于x只能是0,1,c只能是0,1,2那么问题就好办了,对于0, 1, 2对应分别是3种表达式,然后二分深度,搞2-sat即可
代码:
#include
#include
#include
#include
#include
us...
分类:
其他好文 时间:
2014-10-25 17:25:47
阅读次数:
200
HDU 3622 Bomb Game
题目链接
题意:求一个最大半径,使得每个二元组的点任选一个,可以得到所有圆两两不相交
思路:显然的二分半径,然后2-sat去判定即可
代码:
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAX...
分类:
其他好文 时间:
2014-10-25 15:53:59
阅读次数:
174
HDU 3062 Party
题目链接
2sat模板题
代码:
#include
#include
#include
#include
#include
using namespace std;
const int MAXNODE = 2005;
struct TwoSet {
int n;
vector g[MAXNODE * 2];
bool mar...
分类:
其他好文 时间:
2014-10-25 11:58:33
阅读次数:
167
Pasha has many hamsters and he makes them work out. Today,
n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.
For another exercise, Pasha n...
分类:
其他好文 时间:
2014-10-24 11:06:01
阅读次数:
238
链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1212
题意:有n架飞机需要着陆,每架飞机都可以选择“早着陆”或“晚着陆”两种方式,第i架飞机早着陆时间为Ei,晚着陆时间为Li,不得在其他时间着陆。你的任务是为这些飞机安排着陆方式,...
分类:
其他好文 时间:
2014-10-23 17:41:04
阅读次数:
234