双连通图:无向图中每两个顶点都存在完全不同的两条路径 给定一个无向图,问要给它增加多少条边可以把它变成双连通图。 用tarjan缩点,可以得到一棵树,添加(叶子结点+1)/2条边可以使其成环,也就是答案~ 为了避开重边,这题用邻接矩阵存,wa了一晚上QAQ~ #include<cstdio> #in ...
分类:
其他好文 时间:
2020-02-15 20:37:22
阅读次数:
66
utils_paths.py: import os image_types = (".jpg", ".jpeg", ".png", ".bmp", ".tif", ".tiff") def list_images(basePath, contains=None): # return the set ...
分类:
其他好文 时间:
2020-02-15 18:48:31
阅读次数:
85
F. Three Paths on a Tree Description You are given an unweighted tree with nn vertices. Recall that a tree is a connected undirected graph without cyc ...
分类:
其他好文 时间:
2020-02-13 09:54:10
阅读次数:
72
F. Three Paths on a Tree 思路 两种方法: 1.两次bfs求树的直径,顺便求出一个直径端点到所有点的最短距离;再bfs一次,求另一个直径上的端点到其它所有点的最短距离;之后枚举第三个端点(不等于端点1和端点2),dis(a,b) + dis(b,c) + dis(a,c) 再 ...
分类:
其他好文 时间:
2020-02-11 12:01:45
阅读次数:
53
1 """ 2 You have N gardens, labelled 1 to N. In each garden, you want to plant one of 4 types of flowers. 3 paths[i] = [x, y] describes the existence ...
分类:
其他好文 时间:
2020-02-03 22:04:46
阅读次数:
55
Write a program to not only find the weighted shortest distances, but also count the number of different minimum paths from any vertex to a given sour ...
分类:
其他好文 时间:
2020-02-03 15:52:30
阅读次数:
88
F. Three Paths on a Tree 原题链接:https://codeforces.com/contest/1294/problem/F 题目大意: 给定一棵树,选出三点,使三点连成的j简单路径最大。简而言之,三个点连成的边的集合大小。 解题思路: 假设任取一点为三点连线的公共点,最长 ...
分类:
其他好文 时间:
2020-02-03 15:25:01
阅读次数:
66
"传送门" 题意: 给一个n个结点的无权树,三个结点p1,p2,p3,这三个结点组成的三条路径的路径并集(这个意思就是三条路径之间,重复的边算一次)为ans,找出使得ans最大的三个结点,可能答案有多个,输出一种组合即可 思路: 很显然有种最优解的两个结点为直接的端点p1,p2(直接用两次bfs找直 ...
分类:
其他好文 时间:
2020-02-02 01:07:32
阅读次数:
119
添加依赖 application.yml配置 additional paths对于多模块也有效,多模块下只要是此目录下的就会重新加载 idea设置 第一步 Preferences Build,Execution,Deployment Compiler找到 Build Project Automati ...
分类:
编程语言 时间:
2020-01-30 19:00:00
阅读次数:
81
T1:Colorado Potato Beetle
T2:Distinct Paths
T3:回忆树
半夜硬核更博。 ...
分类:
其他好文 时间:
2020-01-30 09:14:35
阅读次数:
85