题目大意:给定一张 N 个点的完全图,求 1,2 号节点之间的一条最小瓶颈路。 题解:可知,最小瓶颈路一定存在于最小生成树(最小瓶颈树)中。因此,直接跑克鲁斯卡尔算法,当 1,2 号节点在同一个联通块时,即可停止算法,并输出答案即可。 代码如下 cpp include include include ...
分类:
其他好文 时间:
2018-12-04 13:06:24
阅读次数:
207
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: ...
分类:
其他好文 时间:
2018-12-01 21:50:58
阅读次数:
198
首先说下解决的思路,就是在最外面嵌套一层自定义的ScrollView,重写其相关方法,判断若为垂直滑动则拦截下来,不交由RecyclerView来处理。 这样的话,滑动冲突就能解决,并且是很流畅的。 不过这样在有些设备可能还会出现个问题, 就是内容显示不全。这里可以通过在显示不全的RecyclerV ...
分类:
移动开发 时间:
2018-12-01 17:05:36
阅读次数:
285
Vasya has a tree consisting of n n vertices with root in vertex 1 1 . At first all vertices has 0 0 written on it. Let d(i,j) d(i,j) be the distance b ...
分类:
其他好文 时间:
2018-11-30 13:46:49
阅读次数:
152
典型DP题,思路上和 LCS 很像。 dp[i][j] 表示word1前i个 word2前j个 所需的最小操作数。 base case: dp[i][0]=i, dp[0][j]=j. 需要额外注意这里的base case。 dp[i][j] = dp[i-1][j-1] if word1[i-1] ...
分类:
其他好文 时间:
2018-11-29 23:19:02
阅读次数:
185
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r... ...
分类:
其他好文 时间:
2018-11-27 10:10:15
阅读次数:
199
由印度统计学家马哈拉诺比斯(P. C. Mahalanobis)提出, 表示数据的协方差距离。它是一种有效的计算两个未知样本集的相似度的方法。 ...
分类:
其他好文 时间:
2018-11-26 13:33:03
阅读次数:
302
承接上上篇博客,在其基础上,加入了Wasserstein distance和correlation prior 。其他相关工作、网络细节(maxout operator)、训练方式和数据处理等基本和前文一致。以下是这两点改进的大概: Wasserstein convolutional neural ...
分类:
其他好文 时间:
2018-11-25 20:07:39
阅读次数:
884
#include using namespace std; struct Distance { int feet; float inches; }; int main() { Distance d1; cout > d1.feet; cout > d1.inches; cout << "\n Fee... ...
分类:
编程语言 时间:
2018-11-24 14:24:12
阅读次数:
181