Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通。 Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的r ...
分类:
其他好文 时间:
2018-09-26 19:09:22
阅读次数:
148
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1406 The Head Elder of the tropical island of Lagrishan has a problem. A burst of fo ...
分类:
其他好文 时间:
2018-09-26 16:11:57
阅读次数:
182
传送门 肯定是最短路 而且题目有限制,不存在负环 所以可以跑堆优化的Dijkstra 但是因为有负边权,所以跑得很慢 这时可以利用题目的条件 每个联通块内是没有负边权的 所以可以优先处理单个块之内的最短路 这样一个块一个块地处理 可以跑得很快 可以用Tarjan处理每个点所在的联通块 代码: 后话: ...
分类:
其他好文 时间:
2018-09-25 14:06:07
阅读次数:
199
P3008 [USACO11JAN]道路和飞机Roads and Planes Dijkstra+Tarjan 因为题目有特殊限制所以不用担心负权的问题 但是朴素的Dijkstra就算用堆优化,也显然会超时。 这是因为Dj每次扩展时,总是找到费用最小那个点进行扩展。 而本题的毒瘤数据可以在一个图(设 ...
分类:
其他好文 时间:
2018-09-21 15:11:53
阅读次数:
164
Problem "CodeForces 835F" 题意:求基环树删去环上任意一边后直径最小值,直径定义为所有点对最近距离的最大值 Solution 首先明确删去环上一点是不会影响树内直径的,所以应当先把所有树的直径求出来,这是树形Dp可以解决的,同时建议使用树形Dp,可以一次性求出接下来要用到的数 ...
分类:
其他好文 时间:
2018-09-18 14:26:18
阅读次数:
140
Description Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such th ...
分类:
其他好文 时间:
2018-09-09 11:35:44
阅读次数:
266
Travel PP loves travel. Her dream is to travel around country A which consists of N cities and M roads connecting them. PP has measured the money each ...
分类:
其他好文 时间:
2018-09-08 22:36:31
阅读次数:
163
262144K There are NN cities in the country, and MM directional roads from uu to v(1\le u, v\le n)v(1≤u,v≤n). Every road has a distance c_ici?. Haze is ...
分类:
其他好文 时间:
2018-09-04 21:41:11
阅读次数:
333
L.Magical Girl Haze 题目链接: https://nanti.jisuanke.com/t/31001 Description There are N cities in the country, and M directional roads from u to v(1≤u,v≤ ...
分类:
其他好文 时间:
2018-09-02 14:32:47
阅读次数:
177
ACM ICPC 2018 南京赛区网络预赛 Magical Girl Haze 最短路 [TOC] 题面 There are N cities in the country, and M directional roads from uu to v(1$\le$ u, v$\le$ n)v(1≤u ...
分类:
其他好文 时间:
2018-09-01 22:04:53
阅读次数:
152