给出一个有向图,从起点走到终点(必须走最短路),问一条边是否一定会被经过,如果不经过它,可以减小它的多少边权使得经过它(边权不能减少到0)正反向建图,分别求出起点到每个点的最短距离,终点到每个点的最短距离(用这个可以算出减小的边权)再将在最短路径上的边重新建图。求出里面的桥,就是必须经过的边wa了一...
分类:
其他好文 时间:
2015-08-11 11:45:54
阅读次数:
178
Constructing Roads
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 20889
Accepted: 8817
Description
There are N villages, which are numbered from 1 to N,...
分类:
其他好文 时间:
2015-08-10 20:06:35
阅读次数:
108
学习了最长上升子序列,刚开始学的n^2的方法,然后就超时了,肯定超的,最大值都是500000,平方之后都12位
了,所以又开始学nlogn算法,找到了学长党姐的博客orz,看到了rating是浮云。。。确实啊,这些不必太关
注,作为一个动力就可以啦。没必要看的太重,重要的事学习知识。
思路:
这道题目可以先对一行排序,然后对另一行求最长上升子序列。。。
n^2算法:
序列a[n],设一...
分类:
编程语言 时间:
2015-08-10 14:55:23
阅读次数:
115
Description
I am going to my home. There are many cities and many bi-directional roads between them. The cities are numbered from 0to n-1 and each road has a cost. There are m roads. You are given ...
分类:
其他好文 时间:
2015-08-09 22:36:49
阅读次数:
154
uva 1486 TransportationDescriptionThere are N cities, and M directed roads connecting them. Now you want to transport K units of goods from city 1 to city N. There are many robbers on the road, so you...
分类:
其他好文 时间:
2015-08-09 17:10:29
阅读次数:
125
【LightOJ 1002】 Country Roads...
分类:
其他好文 时间:
2015-08-08 18:22:27
阅读次数:
110
题目地址:codeforces #pi (DIV2) E
题目很水。。就是先求两边最短路,然后把可能为最短路的边挑出来,然后判断是否yes只需要转化成无向图跑一遍tarjan,找出割边,割边就是yes,然后剩下的边就让它的值为最短路-1就行了,如果-1后变成了非正数,就是no.
但是!!!居然卡spfa!!那是不是说cf以后就不能用可以卡的算法了。。完全可以出组数据来卡这些算法。。。比如spfa...
分类:
其他好文 时间:
2015-08-07 20:19:51
阅读次数:
145
CodeForces 567E President and RoadsDescriptionBerland has n cities, the capital is located in city s, and the historic home town of the President is in city t (s?≠?t). The cities are connected by one-...
分类:
其他好文 时间:
2015-08-07 20:05:20
阅读次数:
144
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define ll long long#define REP(i,a,b)...
分类:
其他好文 时间:
2015-08-07 13:11:50
阅读次数:
87
A - How far away ?
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
There are n houses in the village and some bidirectional roads...
分类:
其他好文 时间:
2015-08-06 00:33:07
阅读次数:
147