上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 33 下一页
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 10008; 8 vectormap[maxn]; 9 bool mark[maxn]; 10 int link[maxn]; 11 int n; 12 13 void init(){ 14 ... 阅读全文
posted @ 2017-09-14 21:43 ouyang_wsgwz 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 额,只是一道签到题,emmm直接代码: 阅读全文
posted @ 2017-09-12 21:09 ouyang_wsgwz 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目大意是有一堆猴子,然后每个猴子都有自己喜欢的香蕉类型,然后香蕉会在指定的位置,问每个猴子能不能在每个地方吃到自己喜欢的香蕉。 其实直接暴力即可(因为最大最大最大是50) 上代码: 阅读全文
posted @ 2017-09-12 20:48 ouyang_wsgwz 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 最开始一直想不通,为什么推出这个公式,后来想了半天,终于想明白了。 题目大意是,有M个格子,有K个物品。我们希望在格子与物品之间连数量尽可能少的边,使得——不论是选出M个格子中的哪K个,都可以与K个物品恰好一一匹配。 然后你可以试着画图,每次必须有k个格子是单独的(与各物体只有一条线相连)所以还剩下 阅读全文
posted @ 2017-09-11 23:09 ouyang_wsgwz 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 最开始一直想着最短路,不过看完题解后,才知道可以做成最长路。唉,还是太菜了。 先上图: 只要自己添加两个点,然后如此图般求最长路即可,emmm,用SPFA可以,迪杰斯特拉也可以,或者别的都ok,只要通过一次即可。 上代码: 阅读全文
posted @ 2017-09-11 21:08 ouyang_wsgwz 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int m, n, q; 7 const int maxn = 50005; 8 int fa[maxn]; 9 int Rank[maxn]; 10 11 void init(){ 12 for (int i = 1; i <= n; i+... 阅读全文
posted @ 2017-09-07 21:41 ouyang_wsgwz 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 同构图是图论中专业的术语,假设G=(V,E)和G1=(V1,E1) 分别是两个图,如果存在一个双射m:即V->V1,然后所有的m(x,y)==m(x1,y1); 其实我的理解简单来说,同构图的点数相同,边数相同,然后,每个点的是一样的(连接了几条线,是否成环) 如果满足上述的条件,且这两个图形是不一 阅读全文
posted @ 2017-09-05 21:25 ouyang_wsgwz 阅读(1109) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 struct node//边 7 { 8 int a, b;//顶点 9 char ch;//运算符 10 }c[10005]; 11 vectormap[10005]... 阅读全文
posted @ 2017-09-02 18:55 ouyang_wsgwz 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #define MAXN 210 5 #define INF 2147483646 6 using namespace std; 7 8 int f[MAXN], Rank[MAXN]; //Rank长度 9 int n, m, pos; 10 11 struct Edge{ 12 int ... 阅读全文
posted @ 2017-09-01 21:21 ouyang_wsgwz 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int n, m; 7 const int maxn = 200005; 8 int fa[maxn]; 9 int sum[maxn]; 10 11 int Find(int x){ 12 if (x == fa[x]) 13 ... 阅读全文
posted @ 2017-09-01 20:29 ouyang_wsgwz 阅读(130) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 33 下一页