CF916E Jamie and Tree 解题报告】的更多相关文章

CF916E Jamie and Tree 题意翻译 有一棵\(n\)个节点的有根树,标号为\(1-n\),你需要维护一下三种操作 1.给定一个点\(v\),将整颗树的根变为\(v\) 2.给定两个点\(u, v\),将\(lca(u, v)\)所在的子树都加上\(x\) 3.给定一个点\(v\),你需要回答以\(v\)所在的子树的权值和 输入输出格式 输入格式: The first line of input contains two space-separated integers \(n\…
CF916E Jamie and Tree 题意翻译 有一棵n个节点的有根树,标号为1-n,你需要维护以下三种操作 1.给定一个点v,将整颗树的根变为v 2.给定两个点u, v,将lca(u, v)所在的子树都加上x 3.给定一个点v,你需要回答以v所在的子树的权值和 Translated by mangoyang 错误日志: 第一次 \(debug\) 是 \(jump\) 数组第二维开小了: 交了一次错了, 第二次没有特判修改/查询节点等于根的情况: 第三次 \(RE\) 又是数组开销了 .…
[LeetCode]863. All Nodes Distance K in Binary Tree 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/description/ 题目描述: We are given a binary tree (with root no…
[LeetCode]297. Serialize and Deserialize Binary Tree 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/serialize-and-deserialize-binary-tree/description/ 题目描述: Serialization is the process of converting a data structure or object into a se…
[LeetCode]331. Verify Preorder Serialization of a Binary Tree 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/description/ 题目描述: One way to serialize a binary tree is to use pre-order traver…
[LeetCode]109. Convert Sorted List to Binary Search Tree 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.me/ 题目地址:https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/description/ 题目描述: Given a s…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/description/ 题目描述 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in…
[LeetCode]99. Recover Binary Search Tree 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/recover-binary-search-tree/description/ 题目描述: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without chan…
[LeetCode]662. Maximum Width of Binary Tree 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/maximum-width-of-binary-tree/description/ 题目描述: Given a binary tree, write a function to get the maximum width of the given tree. The width…
[LeetCode]623. Add One Row to Tree 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/add-one-row-to-tree/description/ 题目描述: Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the…