
图
隔阂0323
加速零到一百公里
展开
-
PREV-49 蓝桥 发现环
问题描述 小明的实验室有N台电脑,编号1~N。原本这N台电脑之间有N-1条数据链接相连,恰好构成一个树形网络。在树形网络上,任意两台电脑之间有唯一的路径相连。 不过在最近一次维护网络时,管理员误操作使得某两台电脑之间增加了一条数据链接,于是网络中出现了环路。环路上的电脑由于两两之间不再是只有一条路径,使得这些电脑上的数据传输出现了BUG。 为了恢复正常传输。小明需要找到所有在环路上的...原创 2019-03-06 21:22:46 · 163 阅读 · 0 评论 -
XYZZY HDU - 1317 SPFA判正环
It has recently been discovered how to run open-source software on the Y-Crate gaming device. A number of enterprising designers have developed Advent-style games for deployment on the Y-Crate. Your j...原创 2019-04-01 18:57:39 · 222 阅读 · 1 评论 -
find the most comfortable road HDU - 1598 Dijkstra + 二分
X星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提速/降速,痛苦呀 ),但XX星人对时间却...原创 2019-04-11 13:07:59 · 224 阅读 · 0 评论 -
Minimum Transport Cost HDU - 1385 SPFA+最小字典序输出+邻接表实现
These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transpor...原创 2019-04-02 13:27:18 · 177 阅读 · 0 评论 -
THE MATRIX PROBLEM HDU - 3666 差分约束系统
You have been given a matrix CN*M, each element E of CN*Mis positive and no more than 1000, The problem is that if there exist N numbers a1, a2, … an and M numbers b1, b2, …, bm, which satisfies th...原创 2019-04-08 20:08:10 · 155 阅读 · 0 评论 -
find the mincost route HDU - 1599 Floyd判最小环
杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。Input第一行是2个整数N和M(N <= 100, M &...原创 2019-04-13 11:19:56 · 121 阅读 · 0 评论 -
Sightseeing HDU - 1688 最短路+次短路
Tour operator Your Personal Holiday organises guided bus trips across the Benelux. Every day the bus moves from one city S to another city F. On this way, the tourists in the bus can see the sights al...原创 2019-04-14 13:20:20 · 244 阅读 · 0 评论 -
Paint the Grid Again ZOJ - 3780 拓扑排序
Leo has a grid withN×Ncells. He wants to paint each cell with a specific color (either black or white).Leo has a magical brush which can paint any row with black color, or any column with white ...原创 2019-04-22 15:22:53 · 139 阅读 · 0 评论 -
The shortest path HDU - 2224 双调欧几里得问题模板
There are n points on the plane, Pi(xi, yi)(1 <= i <= n), and xi < xj (i<j). You begin at P1 and visit all points then back to P1. But there is a constraint:Before you reach the rightmos...原创 2019-04-17 19:05:43 · 162 阅读 · 0 评论 -
最大流之Dinic
网络流基本概念什么是网络流在一个有向图上选择一个源点,一个汇点,每一条边上都有一个流量上限(称为容量),即经过这条边的流量不能超过这个上界。同时,除源点和汇点外,所有点的入流和出流都相等,而源点只有流出的流,汇点只有汇入的流。这样的图叫做网络流。所谓网络或容量网络指的是一个连通的赋权有向图 D= (V,E,C) , 其中V 是该图的顶点集,E是有向边(即弧)集,C是弧上的容量。此外顶...转载 2019-04-24 20:45:25 · 184 阅读 · 0 评论 -
Free DIY Tour HDU - 1224 SPFA求最长路+输出路径
Weiwei is a software engineer of ShiningSoft. He has just excellently fulfilled a software project with his fellow workers. His boss is so satisfied with their job that he decide to provide them a fre...原创 2019-04-01 12:43:58 · 161 阅读 · 0 评论 -
A Walk Through the Forest HDU - 1142 最短路+记忆化搜索DFS
Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is o...原创 2019-04-01 11:12:15 · 111 阅读 · 0 评论 -
LCA总结
概述篇LCA (Least Common Ancestors) ,即最近公共祖先,是指这样的一个问题:在一棵有根树中,找出某两个节点 u 和 v 最近的公共祖先。LCA 可分为在线算法与离线算法在线算法:指程序可以以序列化的方式一个一个处理输入,也就是说在一开始并不需要知道所有的输入。 离线算法:指一开始就需要知道问题的所有输入数据,而在解决一个问题后立即输出结果。 算法篇...转载 2019-03-27 13:22:13 · 1734 阅读 · 0 评论 -
Heavy Transportation POJ - 1797
BackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his cus...原创 2019-03-14 15:35:52 · 153 阅读 · 0 评论 -
LCA总结
LCA(Least Common Ancestors) ,即最近公共祖先,在一棵有根树中,找出某两个节点u和v最近的公共祖先。LCA可以分为在线算法和离线算法在线算法:指程序可以以序列化的形式一个一个输入,也就是说一开始并不知道所有输入。 离线算法:指一开始就知道问题的所有数据,而在解决问题后立即输出结果。1.LCA倍增算法 (在线)时间复杂度:O((n+q)l...转载 2019-03-20 13:57:38 · 887 阅读 · 0 评论 -
How far away ? HDU - 2586
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it hard to...原创 2019-03-20 15:21:03 · 122 阅读 · 0 评论 -
District Division ZOJ - 4045 [树+dfs]
Ezio learned a lot from his uncle Mario in Villa Auditore. He also made some contribution to Villa Auditore. One of the contribution is dividing it into many small districts for convenience of managem...原创 2019-03-12 18:18:36 · 144 阅读 · 0 评论 -
Sum in the tree CodeForces - 1098A
Mitya has a rooted tree withnnvertices indexed from11tonn, where the root has index11. Each vertexvvinitially had an integer numberav≥0av≥0written on it. For every vertexvvMitya has comput...原创 2019-03-12 18:32:03 · 290 阅读 · 0 评论 -
Kefa and Park CodeForces - 580C
Kefa decided to celebrate his first big salary by going to the restaurant.He lives by an unusual park. The park is a rooted tree consisting ofnvertices with the root at vertex1. Vertex1also con...原创 2019-03-25 17:31:21 · 299 阅读 · 0 评论 -
Contestants Division POJ - 3140
In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to the...原创 2019-03-13 20:48:16 · 167 阅读 · 0 评论 -
Buy a Ticket CodeForces - 938D Dijkstra+思维
Musicians of a popular band “Flayer” have announced that they are going to “make their exit” with a world tour. Of course, they will visit Berland as well.There are n cities in Berland. People can tr...原创 2019-03-25 20:46:59 · 228 阅读 · 0 评论 -
Design the city ZOJ - 3195 LCA倍增
Cerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams everywhere. Now, Cerror finds out that the main reason of them is the...原创 2019-03-22 15:07:07 · 115 阅读 · 0 评论 -
Network HDU - 3078 LCA倍增
The ALPC company is now working on his own network system, which is connecting all N ALPC department. To economize on spending, the backbone network has only one router for each department, and N-1 op...原创 2019-03-23 11:40:46 · 184 阅读 · 0 评论 -
最大流最小割定理
最大流最小割定理是网络流理论的重要定理。是指在一个网络流中,从源点到达汇点的最大流量==如果从网络中移除某些边就能够导致网络流中断的边的集合的最小容量和(这些边的权值之和)。即在任何网络中,最大流的值等于最小割的容量。...原创 2019-04-24 20:52:59 · 711 阅读 · 0 评论