F. Three Paths on a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a ...
分类:
其他好文 时间:
2020-01-26 22:34:35
阅读次数:
79
Description 描述 给一棵 $n$ 个点的树,找到三个点,使得两两之间,共三条路径,所经过的边的并集尽可能大。 输入 第一行为一个正整数 $n$($3 \le n \le 2 \times 10^5$)。 接下来 $n -1 $ 行,每行两个数 $u,v$ 表示一条边($1 \le u, ...
分类:
其他好文 时间:
2020-01-26 22:09:26
阅读次数:
120
题意:在一棵树上找三个不同点,使的三点之间的路径通过最多的不同边。 解法:将树看一条长链像有机化学里的结构式,可以肯定长链的两端点(两次dfs找出最长链)是答案中的两点,第三个点有两种情况: 1、没有支链即只有一条长链第三点即为不同于端点的任意一点。 2、有支链,找一条最长的支链的端点(bfs找最长 ...
分类:
其他好文 时间:
2020-01-24 09:27:34
阅读次数:
76
题意: 给一棵树,找到三个顶点,使三个顶点两两之间路径的并集最大 思路: 必定会有一组最优解,使得 a,b是树直径上的端点。 证明: 假设某个答案取连接点x。x最远的树到达的点是s,根据树的直径算法,s是树的某个直径a的端点。假设x的最远和第二远的点组成的链是b,b就会和a有一段公共部分。我们取a和 ...
分类:
其他好文 时间:
2020-01-23 19:56:26
阅读次数:
138
$$ Preface $$ ~~打比赛的时候先开了 F 题(雾~~ ~~然后一眼看出 F 题结论,最后居然因为没有判重,交了三次才过。~~ $$ Description $$ 给出一棵无权树(可理解为边权为 $1$ ),你需要选取三个点 $a,b,c$ ,最大化 $a,b$ 和 $b,c$ 和 $a ...
分类:
其他好文 时间:
2020-01-23 11:14:31
阅读次数:
61
Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or r ...
分类:
其他好文 时间:
2020-01-21 18:21:24
阅读次数:
105
In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the ...
分类:
其他好文 时间:
2020-01-17 21:13:06
阅读次数:
93
/** * 63. Unique Paths II * https://leetcode.com/problems/unique-paths-ii/description/ * https://www.youtube.com/watch?v=8v-dX6ato_Y * */ class Soluti ...
分类:
其他好文 时间:
2020-01-12 15:31:32
阅读次数:
83
二叉树路径。题意是给一个二叉树,请输出从根节点遍历到每个最小的叶子节点的路径。例子 Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] Explanation: All root-to-leaf paths are: 1->2->5, ...
分类:
其他好文 时间:
2020-01-12 13:25:09
阅读次数:
71
文章转自 快速开始 my.ini # possible values : production, development app_mode = development [paths] # Path to where grafana can store temp files, sessions, an ...
分类:
其他好文 时间:
2020-01-09 20:25:54
阅读次数:
80