随笔分类 -  图论

摘要:地址:http://codeforces.com/contest/1406/problem/C 题意: 给出n个点,n-1条边。 通过删除一条边,增加一条边,使得重心唯一 重心:树的某个节点,当去掉该节点后,树的各个连通分量中,节点数最多的连通分量其节点数达到最小值。 解析: 关于重心的一个性质: 阅读全文
posted @ 2020-09-16 21:24 liyexin 阅读(329) 评论(2) 推荐(0)
摘要:地址:http://codeforces.com/contest/33/problem/B 很老的题了,今天被学长拉出来,就做做看。 题意:给出两个字符串,给出n个 a b x,表明字符a可以变成b,每次花费为x。问要想把这俩字符串变成一样的,最少花费多少。无法变就输出-1。 解析:刚开始以为,每次 阅读全文
posted @ 2020-04-15 21:53 liyexin 阅读(176) 评论(0) 推荐(0)
摘要:我用自己的语言解释一下何为二分图:图中所有点分成两部分,就像站队,左边一队,右边一队。同一队两点之间没有关系,不同队的可能存在多种关系。 二分图的最大匹配:比如相亲,左边为男生队,右边为女生队,男女存在多种关系(比如男1喜欢女2和女3),男男之间当然没有关系了。最大匹配就是这么个情况,尽量成全更多的 阅读全文
posted @ 2019-11-10 21:15 liyexin 阅读(372) 评论(0) 推荐(0)
摘要:如果从一个节点开始经历整个图的所有边有且仅有一次,然后回到了起点,这个就是欧拉回路。一笔画问题。 判断方法: 1.无向图中:所给定的图为连通图,且所有节点的度为偶数。 2.有向图中:所给定的图为连通图,且所有节点的度为零。 基础题HDU 1878判断是否为欧拉回路(无向图) 题解:是的话输出1,否则 阅读全文
posted @ 2019-10-30 18:54 liyexin 阅读(293) 评论(0) 推荐(0)
摘要:POJ_3013_最短路 Big Christmas Tree Time Limit: 3000MS Memory Limit: 131072K Total Submissions: 23630 Accepted: 5125 Description Christmas is coming to KC 阅读全文
posted @ 2019-10-29 21:30 liyexin 阅读(151) 评论(0) 推荐(0)
摘要:HDU - 3018 Ant Country consist of N towns.There are M roads connecting the towns. Ant Tony,together with his friends,wants to go through every part of 阅读全文
posted @ 2019-10-19 19:13 liyexin 阅读(148) 评论(0) 推荐(0)
摘要:B - Resort CodeForces - 350B B. Resort time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output V 阅读全文
posted @ 2019-10-12 21:06 liyexin 阅读(214) 评论(0) 推荐(0)
摘要:本题地址 https://cn.vjudge.net/contest/302014#problem/L Median Time Limit: 1 Second Memory Limit: 65536 KB Recall the definition of the median of elements 阅读全文
posted @ 2019-05-18 20:59 liyexin 阅读(493) 评论(0) 推荐(0)