随笔分类 - 树的全家桶/ 树形DP/ LCA/MST/树链剖分
摘要:牛客小白月赛19 E 「火」烈火燎原 (思维,树) 链接:https://ac.nowcoder.com/acm/contest/2272/E来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %ll
阅读全文
摘要:HDU 6187 Destroy Walls (思维,最大生成树) Destroy Walls \ Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Total Submission(
阅读全文
摘要:ACM ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer master has to do his job. A tour company gives him
阅读全文
摘要:"Codeforces Round 329 (Div. 2)" D. Happy Tree Party time limit per test 3 seconds memory limit per test 256 megabytes input standard input output stan
阅读全文
摘要:Make It Connected "CodeForces 1095F " You are given an undirected graph consisting of nn vertices. A number is written on each vertex; the number on v
阅读全文
摘要:"E We Need More Bosses" "CodeForces 1000E " Your friend is developing a computer game. He has already decided how the game world should look like — it
阅读全文
摘要:Successor "HDU 4366 " Sean owns a company and he is the BOSS.The other Staff has one Superior.every staff has a loyalty and ability.Some times Sean wi
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/392/H 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 华华看书了解到,一起玩养成类的游戏有助
阅读全文
摘要:After the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses. Now he likes to watch snowflakes. Once
阅读全文
摘要:B. Beggin' For A Node time limit per test2.0 s memory limit per test256 MB inputstandard input outputstandard output This is an interactive problem Lo
阅读全文
摘要:Consider a tree T with N (1 题意: 给你一颗n个节点的数,让你求出树的重心以及以重心为根的子树中最大的子树节点个数。 思路: 紧扣树的重心的定义: 定义为:在树中招到一个节点,其所有子树中最大的子树节点个数最小,那么这个点就是树的重心,删除重心后,生成的多颗树尽可能的平衡
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/904/E 来源:牛客网 DongDong数颜色 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 DongDo
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/904/E 来源:牛客网 DongDong数颜色 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 DongDo
阅读全文
摘要:You are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour. Let's call colour c dominating in the subtree of vertex v i
阅读全文
摘要:wls 有三棵树,树上每个节点都有一个值 ai,现在有 2 种操作: 1. 将一条链上的所有节点的值开根号向下取整; 2. 求一条链上值的和; 链的定义是两点之间的最短路。 Input 第一行两个数 n, q 分别代表树上点的数量和操作数量。 第二行 n 个整数,第 i 个数代表第 i 个点的值 a
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/180/E 来源:牛客网 树上路径 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 给出一个n个点的树,1号节点
阅读全文
摘要:ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from 1 to n. There are
阅读全文
摘要:题目链接: https://www.cometoj.com/contest/29/problem/A?problem_id=414 Aqours 题目描述 Aqours 正在 LoveLive! 决赛中表演,舞台可以看作是一棵 nn 个点的有根树,其中根节点是 1 号点,ii 号点的父亲节点为 p_
阅读全文
摘要:迫真小游戏 已经提交 已经通过 时间限制:2000ms 内存限制:256MB 73.98% 提交人数:196 通过人数:145 题目描述 H君喜欢在阳台晒太阳,闲暇之余他会玩一些塔防小游戏。 H君玩的小游戏可以抽象成一棵 nn 个节点的有根树,树以 11 为根,每个点的深度定义为其到根的简单路径上的
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/3/B 来源:牛客网 Borrow Classroom 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 每年的B
阅读全文

浙公网安备 33010602011771号