E. Paths and Trees time limit per test: 3 seconds memory limit per test: 256 megabytes input: standard input output: standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than sol…
[题目链接] https://codeforces.com/contest/545/problem/E [算法] 首先求 u 到所有结点的最短路 记录每个节点最短路径上的最后一条边 答案即为以u为根的一棵最短路径生成树 时间复杂度 : O(NlogN) [代码] #include<bits/stdc++.h> using namespace std; ; const long long INF = 1e60; struct edge { int to , w , nxt; }…
[codeforces 293]B. Distinct Paths 试题描述 You have a rectangular n × m-cell board. Some cells are already painted some of k colors. You need to paint each uncolored cell one of the k colors so that any path from the upper left square to the lower right…
D. Two Paths 题目连接: http://codeforces.com/contest/14/problem/D Description As you know, Bob's brother lives in Flatland. In Flatland there are n cities, connected by n - 1 two-way roads. The cities are numbered from 1 to n. You can get from one city t…