随笔分类 - ACM-图论
摘要:DFS找最小环 对于无向无权图,可以直接使用dfs来找最小环,并找出环上的点 例题 http://codeforces.com/contest/1364/problem/D 题意 给出一张图和一个参数k,可以选择完成两个任务中的一个 找到一个独立集恰好有$\lceil k/2 \rceil $个点
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/5675/J 题意 给出两棵同构的树,问最少修改多少点,让两棵树相同,即根节点相同,非根节点父亲节点的编号相同。 题解 设$dp[u1][u2]$为$tree1$的子树根节点为$u1$,$tree2$的子树根节点为$u2$,子树
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/5674/B 题意 现在有一棵树,你要从1开始跳一遍所有的点并且每条边只能走两次,再回到1,每条边都有一个边权,你走过这条边会先消耗$w_i$点HP,每个点都有一个果子,吃掉这个果子会上升$a_i$点HP,你在任何时候的HP不能
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/5673/A 题意 有n个篮球运动员,m个球迷。 一个球迷可能是多个球员的粉丝 选择最少的球员进全明星赛,使得所有球迷都愿意观看(至少一个球迷想看的球员入选)。 想看的球员标准如下 有q个粉丝关系的修改,修改完回答询问。$1 \
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/5673/I 题意 给了两个数组:\(\{a_1, a_2, \dots a_n\}, \{b_1, b_2, \dots b_n\}\) 第i步可以从$a_i$和$b_i$中选择一个数。 求最后选出的数中,不同的数要最多 题解
阅读全文
摘要:Codeforces 1323E Instant Noodles Wu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. Aft
阅读全文
摘要:Codeforces 1327D Infinite Path You are given a colored permutation $p_1, p_2, \dots, p_n$. The i th element of the permutation has color $c_i$. Let's
阅读全文
摘要:Description You have a directed weighted graph with n vertexes and m edges. The value of a path is the sum of the weight of the edges you passed. Note
阅读全文
摘要:题目链接 http://acm.csu.edu.cn:20080/csuoj/problemset/problem?pid=2110 题目 Description Kevin has just gotten back to his car after a morning at the beach a
阅读全文
摘要:题目链接 http://acm.csu.edu.cn:20080/csuoj/problemset/problem?pid=1989 题目 Description A国一共有N座城市,由M条双向公路连接。小X现在位于S市,他正在赶往T市。小X的时间有限,他还剩下L的时间。另外,到达每座城市,小X都需
阅读全文
摘要:CSU "2031" Barareh on Fire Description The Barareh village is on fire due to the attack of the virtual enemy. Several places are already on fire and t
阅读全文
摘要:CSU "1908" The Big Escape Description There is a tree like prison. Expect the root node, each node has a prisoner, and the root node is the only exit.
阅读全文
摘要:noip 2018 d2t1 旅行 ( 题目来自洛谷 ) 给定n个城市,m条双向道路的图, 不存在两条连接同一对城市的道路,也不存在一条连接一个城市和它本身的道路。并且, 从任意一个城市出发,通过这些道路都可以到达任意一个其他城市。小 Y 只能通过这些道路从一个城市前往另一个城市。 小 Y 的旅行方
阅读全文

浙公网安备 33010602011771号