
图的遍历
jia_zheng
这个作者很懒,什么都没留下…
展开
-
深度优先搜索 (DFS)
从图中的某顶点V出发,访问此顶点,然后依次从V的各个未被访问的邻接点出发,深度优先搜索遍历图,如果发现不能到达目标解,就返回上一个节点,然后从另一条路开始走到底,直到图中所有与V路径想通的顶点都被访问到,这种尽量往深处走的概念既是深度优先搜索。 简略代码:const int MAXN=1000+10; 需使用的变量: vector<int> g[MAXN];//存储边 bool visited原创 2016-11-28 19:55:22 · 351 阅读 · 0 评论 -
Oil Deposits(深度优先搜索DFS)
F - Oil Deposits Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description The GeoSurvComp geologic survey company is responsible for detecting undergrou原创 2016-11-28 20:03:15 · 386 阅读 · 0 评论 -
Red and Black (深度优先搜索 DFS)
G - Red and Black Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description There is a rectangular room, covered with square tiles. Each tile is colored原创 2016-11-28 20:11:00 · 527 阅读 · 0 评论 -
SDNU 1320 Look for homework
Description Super scholar robs the all homework of others.The monitor decides to combat with the super scholar so as to help students to get back the homework.But super scholar lives in a castle b原创 2017-02-22 21:52:32 · 282 阅读 · 0 评论