摘要:
转自:http://www.cnblogs.com/jackge/archive/2013/04/29/3051273.html 算法:最短路和次短路。Dijkstra算法。采用邻接表建图。 总结:不要用邻接矩阵。因为有重边。 dis[x][2]:dis[x][0]表示起点到x的最短路、... 阅读全文
摘要:
题意: 求 1-N 的第二长路,一条路可以重复走 if two or more shortest paths exist, the second-shortest path is the one whose length is longer than those but no longer th... 阅读全文
摘要:
题意:如果存在一个串是另一个串的公共前缀就是NO,否则就是YES思路:利用字典树的特性搞搞就好了#include using namespace std;const int N=1e5+10;//一共有n(10000)个串,每个串有10个数字struct Trie{ Trie* next[... 阅读全文