图论
文章平均质量分 68
喵头鹰
一只小弱鸡~~
展开
-
HDU 5988 Coding Contest 最小费用流变形
题目描述:Problem Description A coding contest will be held in this university, in a huge playground. The whole playground would be divided into N blocks, and there would be M directed paths linking these原创 2016-11-29 20:57:46 · 963 阅读 · 2 评论 -
POJ 2485 Highways 最小生成树的最大边
题目描述:Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this pro原创 2016-08-16 21:13:43 · 330 阅读 · 0 评论 -
HDU 5723 Abandoned country 最小生成树
题目描述:Problem Description An abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads to b原创 2016-07-21 10:19:01 · 314 阅读 · 0 评论 -
CodeForces 682C Alyona and the Tree 搜索
题目描述:Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a num原创 2016-06-20 13:52:55 · 1203 阅读 · 0 评论 -
hdu 3018 Ant Trip 欧拉回路
题目描述:Ant Country consist of N towns.There are M roads connecting the towns. Ant Tony,together with his friends,wants to go through every part of the country. They intend to visit every road , and every原创 2016-03-15 17:05:30 · 308 阅读 · 0 评论 -
HDU 2444 The Accomodation of Students 二分图的判断与匹配
题目描述:Description There are a group of students. Some of them may know each other, while others don’t. For example, A and B know each other, B and C know each other. But this may not imply that A and C原创 2016-04-18 19:24:27 · 259 阅读 · 0 评论 -
POJ 1094 Sorting It All Out 拓扑排序
题目描述:DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequenc原创 2016-06-18 11:19:58 · 303 阅读 · 0 评论 -
POJ 1985 Cow Marathon 搜索
题目描述:DescriptionAfter hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has committed to create a bovine marathon for his cows to run. The maratho原创 2016-06-15 20:04:40 · 289 阅读 · 0 评论 -
POJ 2314 Reactor Cooling 有上下限的最大流
题目描述:Description The terrorist group leaded by a well known international terrorist Ben Bladen is buliding a nuclear reactor to produce plutonium for the nuclear bomb they are planning to create原创 2016-04-14 11:36:04 · 414 阅读 · 0 评论 -
ACdream 1227 Beloved Sons 二分图最大权匹配
题目描述:Description Once upon a time there lived a king and he had N sons. And the king wanted to marry his beloved sons on the girls that they did love. So one day the king asked his sons to come原创 2016-06-26 19:36:34 · 318 阅读 · 0 评论 -
CodeForces Round#22 C System Administrator 构造割点图
题目描述:Description Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit原创 2016-05-06 12:27:42 · 778 阅读 · 0 评论 -
HDU 4635 Strongly connected 连通图
题目描述:Description Give a simple directed graph with N nodes and M edges. Please tell me the maximum number of the edges you can add that the graph is still a simple directed graph. Also, after you add原创 2016-05-05 12:20:16 · 412 阅读 · 0 评论 -
POJ 1144 Network 无向图求割点Tarjan
题目描述:Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N. No two places have the same number.原创 2016-05-05 11:57:43 · 375 阅读 · 0 评论 -
POJ 2594 Treasure Exploration 最短路+二分图
题目描述:Description Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you原创 2016-04-19 10:38:52 · 286 阅读 · 0 评论 -
POJ 1679 The Unique MST 次小生成树
题目描述:Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G原创 2016-08-16 21:17:41 · 328 阅读 · 0 评论 -
HDU5876 Sparse Graph 补图的最短路
题目描述:Problem Description In graph theory, the complement of a graph G is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are not adjacent in G. Now原创 2016-09-12 09:51:47 · 305 阅读 · 0 评论 -
Codeforces Gym 101138C Stickmen 暴力搜索+组合数
题目描述:Limak is a little bear who loves to play with graphs. Recently, he defined a new structure in a graph and called it a stickman.A stickman is a set of 7 different vertices and 6 edges. Vertices sho原创 2016-10-28 16:19:31 · 574 阅读 · 0 评论 -
HDU 5952 Counting Cliques 暴力搜索
题目描述:Problem Description A clique is a complete graph, in which there is an edge between every pair of the vertices. Given a graph with N vertices and M edges, your task is to count the number of cliq原创 2016-10-30 19:57:12 · 2272 阅读 · 2 评论 -
拓扑排序模板
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <queue>using namespace std;const int maxn=30;int head[maxn],ip,indegree[maxn];int n,m,seq[maxn];struct note{转载 2016-03-27 15:36:09 · 300 阅读 · 0 评论 -
UFS并查集 模板
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>const int maxn=1e5+10;using namespace std;int f[maxn];void init(int n){ for(int i=1; i<=n; i++) f[i原创 2016-08-01 15:51:00 · 295 阅读 · 0 评论 -
前向星式prim模板
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>const int maxn=110;const int INF=0x3f3f3f3f;using namespace std;struct edge{ int to,w,next;} edge[maxn];bool vis[ma原创 2016-08-01 15:40:43 · 363 阅读 · 0 评论 -
二分图染色模板
#include <iostream>#include <cstdio>#include <cstring>#include <vector>using namespace std;const int MAX_V = 205;vector<int> G[MAX_V]; // 图int V; // 顶点数int color[MAX_V]; //原创 2016-10-17 19:28:37 · 847 阅读 · 0 评论 -
HDU 5469 Antonidas dfs减枝
题目描述:Problem Description Given a tree with N vertices and N−1 edges. Each vertex has a single letter Ci. Given a string S, you are to choose two vertices A and B, and make sure the letters catenated o原创 2016-10-26 21:04:34 · 311 阅读 · 0 评论 -
UVA 6907 Body Building Tarjan找桥
题目描述: 题目分析:给定一个哑铃图的定义:由两个相同的完全图和一个桥构成。如题目描述的A图B图和C图。 给一个图(有可能不连通),求有多少个哑铃图。这题的n和m太小了,所以可以暴力每一条边,把这条边当做桥。 也可以用tarjan求桥。 最后就是判定桥两边的子图是否是相同的完全图,也就是他们的边数和点数是否相等,并且边数和点数满足完全图条件就可以。 分别以桥的两个端点,一个当做原创 2016-10-24 21:14:22 · 295 阅读 · 0 评论 -
UVA 6910 Cutting Tree 并查集
题目描述:Tree in graph theory refers to any connected graph (of nodes and edges) which has no simple cycle, while forest corresponds to a collection of one or more trees. In this problem, you are given a f原创 2016-10-21 12:40:07 · 372 阅读 · 0 评论 -
HDU 5889 Barricade 最短路+网络流
题目描述:Problem Description The empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as N towns and M roads, and each road has the same length and co原创 2016-09-24 11:56:38 · 258 阅读 · 0 评论 -
HDU 5883 The Best Path 欧拉图
题目描述:Problem Description Alice is planning her travel route in a beautiful valley. In this valley, there are N lakes, and M rivers linking these lakes. Alice wants to start her trip from one lake, and原创 2016-09-19 12:57:27 · 279 阅读 · 0 评论 -
Gym 100703A Tea-drinking 最小生成树
题目描述:Description Castles Valley was lit by the noonday sun. One could descry two figures on a balcony of one of Castles — a big and a small ones. Dragon and Princess were drinking tea. Dragon was fond原创 2016-09-19 12:39:34 · 240 阅读 · 0 评论 -
SCU 4444 Travel 完全图的最短路求法
题目描述:The country frog lives in has nn towns which are conveniently numbered by 1,2,…,n1,2,…,n.Among n(n−1)2n(n−1)2 pairs of towns, mm of them are connected by bidirectional highway, which needs aa minu原创 2016-09-12 20:57:15 · 777 阅读 · 0 评论 -
POJ3694 Network 无向图的桥
题目描述:Description A network administrator manages a large network. The network consists of N computers and M links between pairs of computers. Any pair of computers are connected directly or indirectly原创 2016-05-13 13:15:40 · 486 阅读 · 0 评论 -
HDU 4587 TWO NODES 无向图的割点
题目描述:Description Suppose that G is an undirected graph, and the value of stab is defined as follows: Among the expression,G -i, -j is the remainder after removing node i, node j and all edges that a原创 2016-05-13 12:54:46 · 367 阅读 · 0 评论 -
HDU 4751 Divide Groups 二分图判断
题目描述:Description(这里原来有一张图但是我不明白有什么卵用我就不放了) This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is going to invite distinguished alumnus back to visit and ta原创 2016-04-18 20:22:49 · 344 阅读 · 0 评论 -
HDU 5137 How Many Maos Does the Guanxi Worth
题目描述:Description“Guanxi” is a very important word in Chinese. It kind of means “relationship” or “contact”. Guanxi can be based on friendship, but also can be built on money. So Chinese often say “I do原创 2016-03-25 19:28:57 · 297 阅读 · 0 评论 -
POJ 1062 昂贵的婚礼
题目描述:Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:”嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。”探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币原创 2016-03-25 11:45:07 · 363 阅读 · 0 评论 -
HDU 5294 Tricks Device 最短路建图+最小割(最大流)
题目描述:Description Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the entrance of the tomb while Dumb Zhang’s at the end of it. The tomb is made up of many chambers, the total numb原创 2016-04-06 21:24:02 · 537 阅读 · 0 评论 -
HDU 4289 Control 网络流
题目描述:Description You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (the source) to anot原创 2016-04-06 18:55:39 · 273 阅读 · 0 评论 -
HDU 4292 FOOD 网络流
题目描述:Description You, a part-time dining service worker in your college’s dining hall, are now confused with a new problem: serve as many people as possible. The issue comes up as people in your原创 2016-04-06 12:38:25 · 350 阅读 · 0 评论 -
HDU 5379 Mahjong tree
题目描述:Description Little sun is an artist. Today he is playing mahjong alone. He suddenly feels that the tree in the yard doesn’t look good. So he wants to decorate the tree.(The tree has n vertexs, in原创 2016-04-01 19:57:26 · 209 阅读 · 0 评论 -
Children's Dining POJ2438 哈密顿图
题目描述:Usually children in kindergarten like to quarrel with each other. This situation annoys the child-care women. For instant, when diner time comes, a fierce conflict may break out when a certain cou原创 2016-03-20 16:12:26 · 241 阅读 · 0 评论 -
Instrusive hdu 5040 优先队列+BFS
题目描述:The legendary mercenary Solid Matt gets a classic mission: infiltrate a military base. The military base can be seen as an N * N grid. Matt’s target is in one of the grids and Matt is now in anoth原创 2016-03-19 21:23:31 · 350 阅读 · 0 评论