HDU 3749 Financial Crisis】的更多相关文章

Financial Crisis 题意:给一个图,包含N ( 3 <= N <= 5000 )个点, M ( 0 <= M <= 10000 )条边 and Q ( 1 <= Q <= 1000 )次查询.查询:两个点是否是点-双连通: 点-双连通:两点至少存在两条"点不重复"的路径:简称双连通(biconnected); 思路:直接调用dfs求割点的算法,其实也是Tarjan发明的,就是在判断出一个割点之后,就把栈S中该双连通分量的所有点(就在栈顶…
Because of the financial crisis, a large number of enterprises go bankrupt. In addition to this, other enterprises, which have trade relation with the bankrup enterprises, are also faced with closing down. Owing to the market collapse, profit decline…
题意: 给一个图n个点m条边(不一定连通),接下来又q个询问,询问两个点是为“不相连”,“仅有一条路径可达”,“有两条及以上的不同路径可达”三种情况中的哪一种.注:两条以上的路径指的是路径上的点连1个点也不重复. 思路:并查集+tarjan求割点. (1)情况一:先并查集处理,如果两个点从一开始就不连通,直接输出zero (2)情况二和情况三:两点既然连通,那么可能是只有1条路径,比如中间隔着一个割点:也可能有多条路径,比如在同一个双连通分量内.那么直接判断其是否在同一个双连通分量内即可,若在同…
<题目连接> 题目大意: 给你一个(保证输入无重边,无自环)无向图,然后有下面Q条询问,每条询问为:问你u点与v点之间有几条(除了首尾两点外,其他点不重复)的路径.如果有0条或1条输出0或1,如果有2条以上,输出”two or more”. 解题分析: 我们可以用并查集判断两点之间是否有路径相连通,如果两点不连通,则直接输出0即可.至于判断两点之间有几条不重复的路径相连,则是通过这两点是否属于同一点双连通分量来判断.不过需要注意的是,我们应该排除只有两个点的点双连通分量这一特殊情况.所以综上,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1064 解题报告:用来凑个题数吧,看题的时间比过题的时间多的多,就是输入12个浮点数,然后输出平均数,只是前面加个美元符号就行了,另外保留两位小数,快去水吧. main() { ,x,tot = ; ;i <= ;++i) scanf("%lf",&x),tot += x; printf(); }…
H - 贪心 Crawling in process... Crawling failed Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description     Most financial institutions had become insolvent during financial crisis and went bankrupt or were boug…
Building Fence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 171    Accepted Submission(s): 25Special Judge Problem Description Long long ago, there is a famous farmer named John. He owns a bi…
A - Building Fence Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u Submit Status Description Long long ago, there is a famous farmer named John. He owns a big farm and many cows. There are two kinds of cows on his farm, o…
这一次是做练习,主要了解了两个算法,最大子矩阵和,最长上升子序列. 先看题好啦. A - To The Max Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1081 Description Given a two-dimensional array of positive and negative integers, a sub-re…
POJ1144 网络 description: 给出一张\(N\)个点的无向图,求其中割点的个数 data range: \(N\le 100\) solution: 一道模板题(但是读入实在是把我恶心坏了) #include<cstdio> #include<vector> #include<algorithm> #include<iostream> #include<sstream> using namespace std; const in…