The King’s Problem 强连通】的更多相关文章

题意  有n个城市 m条有向边 将n个城市分成几个州 1.强连通必定在一个州里 2.州里的任意两个城市  u,v     满足u到v 或者v到u  其一即可 先缩点  然后求最小路就覆盖 #include<bits/stdc++.h> #include<iostream> #include<cstring> #include<cstdio> using namespace std; //input by bxd #define rep(i,a,b) for(…
先找出强连通分量缩点,然后就是最小路径覆盖. 构造一个二分图,把每个点\(i\)拆成两个点\(X_i,Y_i\). 对于原图中的边\(u \to v\),在二分图添加一条边\(X_u \to Y_v\). 最小路径覆盖 = 顶点个数 - 最大匹配数 #include <cstdio> #include <cstring> #include <algorithm> #include <stack> using namespace std; const int…
对多校赛的题目,我深感无力.题目看不懂,英语是能懂的,题目具体的要求以及需要怎么做没有头绪.样例怎么来的都不明白.好吧,看题解吧. http://www.cnblogs.com/kane0526/archive/2013/07/21/3203992.html 题目大意: 把一幅有向图中的点最少可以划分为几个区域.划分的规则是:1.可以互相到达的点必须在同一区域.2.每个城市都必须被划分.3.对于属于同一区域中的任意两点,要么满足u->v,要么满足v->u. 第三条规则需要着重解释一下.对于测试…
<题目链接> 题目大意: 一个有向图,让你按规则划分区域,要求划分的区域数最少. 规则如下:1.所有点只能属于一块区域:2,如果两点相互可达,则这两点必然要属于同一区域:3,区域内任意两点至少有一方能够到达另一方. 解题分析: 双连通的两点必须要属于一块区域,所以可以直接对相互连通的点进行缩点,然后再分析缩点后的图像,因为题目要求划分的区域最少,且区域内的"点"之间至少有一方能够到达另一方.仔细思考后,发现就是对缩点后的图求最小路径覆盖.区域内的"点"至…
The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2259    Accepted Submission(s): 795 Problem Description In the Kingdom of Silence, the king has a new problem. There are N citi…
HDU 3861 The King's Problem 题目链接 题意:给定一个有向图,求最少划分成几个部分满足以下条件 互相可达的点必须分到一个集合 一个对点(u, v)必须至少有u可达v或者v可达u 一个点仅仅能分到一个集合 思路:先强连通缩点,然后二分图匹配求最小路径覆盖 代码: #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include &l…
The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description In the Kingdom of Silence, the king has a new problem. There are N cities in the kingdom and there are M directional roads betw…
The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4080    Accepted Submission(s): 1430 Problem Description In the Kingdom of Silence, the king has a new problem. There are N cit…
The King's Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2137    Accepted Submission(s): 763 Problem Description In the Kingdom of Silence, the king has a new problem. There are N cit…
The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2947    Accepted Submission(s): 1049 Problem Description In the Kingdom of Silence, the king has a new problem. There are N cit…