http://poj.org/problem?id=3207 题意:一个圆上顺时针依次排列着标号为1-n的点,这些点之间共有m条边相连,每两个点只能在圆内或者圆外连边.问是否存在这些边不相交的方案.(n<=1000, m<=500) #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <iostream> using n…
http://poj.org/problem?id=3207 Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 7021   Accepted: 2604 Description liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping wi…
POJ 3207 Ikki's Story IV - Panda's Trick(2-sat问题) Description 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 easy games and wants to play another game…
Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 7296   Accepted: 2705 Description liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many tim…
Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 6691   Accepted: 2496 Description liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many tim…
注意到相交的点对一定要一里一外,这样就变成了2-SAT模型 然后我建边的时候石乐志,实际上不需要考虑这个点对的边是正着连还是反着连,因为不管怎么连,能相交的总会相交,所以直接判相交即可 然后tarjan缩点,再判是否合法即可 #include<iostream> #include<cstdio> using namespace std; const int N=100005; int n,m,h[N],cnt,l[N],r[N],dfn[N],low[N],tot,s[N],top…
题意: 有一个环,环上n个点,现在在m个点对之间连一条线,线可以往圆外面绕,也可以往里面绕,问是否必定会相交? 思路: 根据所给的m条边可知,假设给的是a-b,那么a-b要么得绕环外,要么只能在环内,除非a和b是连续的点才不会影响到任何弧,否则一定会多少影响其他弧的走势.比如样例所举出的 0-2和 1-3,就必须有一条弧选择外环,一个选择内环. 如何使他们有序不冲突呢?其实这题跟环上的点没多大关系,而且给的点数n也没什么用,而倒是边才重要.我们要做的是让边不冲突.那么肯定是要先选出可能冲突的边来…
题意: 平面上,一个圆,圆的边上按顺时针放着n个点.现在要连m条边,比如a,b,那么a到b可以从圆的内部连接,也可以从圆的外部连接.给你的信息中,每个点最多只会连接的一条边.问能不能连接这m条边,使这些边都不相交. 解题报告: 题意可能刚开始不是很好理解,比如1 5连边,2,6连边,由于点是顺序排列的,一画图就可以发现,这两条边必须一个从圆外面连,一个从内部连,否则就会相交.如果再加入3 7这条边,那么就必须相交了. 这样,就可以转化成标准的2-sta问题: 1:每个边看成2个点:分别表示在内部…
POJ 3207 Ikki's Story IV - Panda's Trick 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 easy games and wants to play another game with Ikki. liympanda…
题目 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 easy games and wants to play another game with Ikki. liympanda has a magic circle and he puts it on a…