摘要: 基础的2-SAT求任意方案的题目。Priest John's Busiest DayTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7309Accepted: 2492Special JudgeDescriptionJohn is the only priest in his town. September 1st is the John's busiest day in a year because there is an old legend in the town that the couple who g 阅读全文
posted @ 2013-10-01 22:37 chenhuan001 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 2-SAT 求出可能的解,但是这个解要是字典序最小的,所以只能采用2-SAT基本思想来解。从小到大开始,对一个可能的点染色,染为1,然后dfs其所有能到达的点,如果其中出现一个已经标号为-1的话,那么就说明这个点不能选。 然后把之前标好的号清除掉。 如果没有出现的话,那么就保持染色。 如果出现同一集合的两个点都不能染色的话就说明无解。 否则输出所有染为1的点。Peaceful CommissionTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 阅读全文
posted @ 2013-10-01 15:05 chenhuan001 阅读(260) 评论(0) 推荐(0) 编辑