题目链接:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1565
orz题目太神。。。膝盖已经跪烂。。。。
这题需要我们建立起植物和植物之间复杂的保护关系,以及吃植物得到的损失和回报,因此要用最大流搞,建模太神奇了,跪跪跪。。。
首先我们建立源点和汇点,对于每个植物,如果吃它可以得到能源,在源点和它之间连一条边,容量为得到的能源数量。...
分类:
编程语言 时间:
2014-12-05 19:20:09
阅读次数:
297
拓扑排序介绍拓扑排序(Topological Order)是指,将一个有向无环图(Directed Acyclic Graph简称DAG)进行排序进而得到一个有序的线性序列。这样说,可能理解起来比较抽象。下面通过简单的例子进行说明!例如,一个项目包括A、B、C、D四个子部分来完成,并且A依赖于B和D...
分类:
编程语言 时间:
2014-12-05 14:11:07
阅读次数:
295
Problem Description
Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewa...
分类:
编程语言 时间:
2014-12-05 00:45:43
阅读次数:
316
题目链接:http://poj.org/problem?id=1094分析:此题目涉及到图论拓扑排序的多个知识点:1.判断给定的图是否可以拓扑排序;2.判断给定的图能否产生一个唯一的拓扑排序,即全序;代码如下:#include #include #include using namespace st...
分类:
其他好文 时间:
2014-12-05 00:35:57
阅读次数:
138
The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else.
Today is the...
分类:
编程语言 时间:
2014-12-04 23:16:43
阅读次数:
244
题目链接:http://hihocoder.com/problemset/problem/1079 离散化 + 线段树。 这道题卡了我一个多星期,因为我线段树入手不久,基础不牢固,刚开始编出来的时候程序就是崩,这个地方困扰了好几天,后来找到原因后做了改动。改动后程序是不崩了,样例都过不了,后来...
分类:
其他好文 时间:
2014-12-04 17:38:37
阅读次数:
171
我们来看一道题目:hihoCoder #1015 : KMP算法 输入 第一行一个整数N,表示测试数据组数。 接下来的N*2行,每两行表示一个测试数据。在每一个测试数据中,第一行为模式串,由不超过10^4个大写字母组成,第二行为原串,由不超过10^6个大写字母组成。 其中N
#include
usi...
分类:
编程语言 时间:
2014-12-04 13:50:52
阅读次数:
178
没什么难的,提示已经说得很明白了。HihoCoder目前还不支持C++11,囧..#include #include #include #include #include #include using namespace std;//struct Node{ Node(char rc) : c...
分类:
其他好文 时间:
2014-12-04 06:18:38
阅读次数:
210
10305 - Ordering Tasks
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed.
Input
The i...
分类:
编程语言 时间:
2014-12-04 01:01:21
阅读次数:
280
本文将从以下几个方面介绍拓扑排序:
拓扑排序的定义和前置条件和离散数学中偏序/全序概念的联系
典型实现算法
Kahn算法基于DFS的算法
解的唯一性问题
实际例子
取材自以下材料:
http://en.wikipedia.org/wiki/Topological_sorting
http://en.wikipedia.org/wiki...
分类:
编程语言 时间:
2014-12-01 19:17:41
阅读次数:
502