POJ1703Find them, Catch them】的更多相关文章

Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42416   Accepted: 13045 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Drago…
Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 41928   Accepted: 12886 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Drago…
Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 37722   Accepted: 11632 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Drago…
Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 32073   Accepted: 9890 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon…
                                         Find them, Catch them 好久没有做并查集的题,竟然快把并查集忘完了. 题意:大致是有两个监狱,n个犯人,m次操作,每次操作可以是查询也可以是确定两个人是否在同一个监狱里. 思路:其实这题完全可能做出来,结果就是没做出来.理清思路还是很好想的,我们用一个并查集来把能够确定在同一监狱里的人放在一个集合里,用一个diff数组把确定不同监狱的两个犯人分别与对方不同监狱的犯人放在一个集合里,就是这么简单.…
Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64u SubmitStatus Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang D…
/* 题目大意:有两个不同的黑帮,开始的时候不清楚每个人是属于哪个的! 执行两个操作 A a, b回答a, b两个人是否在同一帮派,或者不确定 D a, b表示a, b两个人不在同一个帮派 思路:利用并查集将相同帮派的人合并到一起! a ,b 不在同一个城市,那么 a, 和mark[b]就在同一个城市, b 和 mark[a]就在同一个城市! */ #include<iostream> #include<cstring> #include<cstdio> #define…
题目链接:http://poj.org/problem?id=1703 题目大意:给n个人,m次询问.A代表询问a, b之间的关系,D代表给出a, b属于不同的帮派. 我的想法: 太菜了,上课的时候没想到这种方法. 思路: 1.感觉有点像2-sat的思想,对于D给出的a, b两人属于不同帮派.我们就将a于b的对立点用并查集维护在一个集合中,也将b于a的对立点连通. 2.查询时,若a,b两人pre值相等则属于同一帮派.若a与b的对立点属于同一集合,或b与a的对立点属于同一集合,则说明a与b属于不同…
Time Limit: 1000MSMemory Limit: 10000K Total Submissions: 32909Accepted: 10158 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, t…
在.net中我们经常用到try catch.不过在sqlserver中我们也可以使用try catch捕捉错误,在这里把语法记录下来和大家分享一下, --构建存储过程CREATE PROCEDURE TestProc @Para  INTAS BEGIN TRAN DECLARE @tran_error int SET @tran_error = 0 BEGIN TRY ---这里是存储过程的业务逻辑 DELETE FROM table END TRY BEGIN CATCH   --捕捉错误 …