palindromic solution hossam tree
element-ui tree 异步树实现勾选自动展开、指定展开、指定勾选
element-ui tree 异步树实现勾选自动展开、指定展开、指定勾选 背景 项目中用到了vue的element-ui框架,用到了el-tree组件。由于数据量很大,使用了数据懒加载模式,即异步树。异步树采用复选框进行结点选择的时候,没法自动展开,官方文档找了半天也没有找到好的办法! 找不到相关 ......
「模拟赛」Solution Set
\(\text{heart}\) \(\text{Solution}\) 可以记 \(f(u)\) 为从 \(u\) 出发到某个点停止的方案数,\(f(u)\) 可以 \(O(n)\) 转移,显然复杂度为 \(O(n^2)\). 当前我们要转移 \(u\) 子树内,对于 \(v\in \text{s ......
Solution - Makoto and a Blackboard
Link。 朴素 dp 应该不用说了。放个用 map 的代码。 int dfs(int n, int k) { if (!k) return n; if (f[make_pair(n, k)]) return f[make_pair(n, k)]; int tot = 0, ans = 0; for ......
公告 & Solution - 公路旅行
以后应该会用 Obsidian 搭个博客,博客园可能会被弃用了。 为了有点价值放个不知道什么东西上来。 Link。 不会 T1!原来用到了神秘的倍增!但是我写了一个申必二分,最坏 \(O(qn \log n)\),甚至不如暴力,我是🤡。 类似于 ST 表那样,\(f_{i, j}\) 表示从 \( ......
D. Score of a Tree
D. Score of a Tree You are given a tree of $n$ nodes, rooted at $1$. Every node has a value of either $0$ or $1$ at time $t=0$. At any integer time $t ......
Palindrome-less Arrays
here 哥们不会组合数学。 首先类似这题,得出没有回文串的充要条件是没有长度为 3 的回文串。 长度为 3 的回文串,\(a_i,a_{i+1},a_{i+2}\),只要满足 \(a_i \neq a_{i+2}\) 即可,也就是说奇数位、偶数位抠出来,新数组中相邻的数不相同。 考虑 dp,一种显 ......
B. Hossam and Friends
B. Hossam and Friends 题目大意: 有\(n\)对朋友,其中\(m\)对朋友互相不认识,让你选区间,最多可以选多少区间,区间中没有互相不认识的朋友 思路: 遍历每个点作为区间的左端点,必须满足\(a[i]\le a[i+1]\)(\(a[i]\)存储以\(i\)做左端点,右端点的 ......
[题解] CFgym101623F Factor-Free Tree
Factor-Free Tree 当一棵二叉树中的每个节点的权值都与它所有祖先的权值互质时,我们称它为 factor-free tree。 给你一棵按照中序遍历的顺序的权值序列 \(a\),求这个序列是否对应这一棵 factor-free tree。 如果是就输出每个节点的父亲。 \(n \le 1 ......
数据存储和检索:B-tree 和 LSM-tree
本文主要介绍数据库的核心数据结构索引的实现方式:B+tree 和 LSM-tree。索引是基于原始数据派生而来的额外数据结构。很多数据库允许单独添加和删除索引,而不影响数据库的内容,它只会影响查询性能。维护额外的数据结构势必会引入开销,特别是在新数据写入时,因此,了解当前主流的索引实现方式和其优缺点... ......
solution-CF1615F
LEGOndary Grandmaster https://www.luogu.com.cn/problem/CF1615F 神题!看到题解一眼就知道自己大概率想不出来了。 主要还是积累两个套路: Trick 1 考虑将原序列的奇数位位置上的数取反,惊讶地发现操作简化为了每次交换相邻两个数。显然地, ......
[Luogu NOIP 2023 模拟] Solution
这篇 blog 在我的博客后台躺了好几天了,只不过今天才记起来发。 种树 (plant) 首先看到因数个数,想到在质因数分解后的序列上考虑问题。进一步观察,每个不同质因子的贡献是独立的。 也就是说,我们单独考虑某一个质因子对答案的贡献,是这样的问题: 给长度为 \(n\) 的序列 \(a\) 和一个 ......
Solutions of Soil Salinization
Soil salinization prevention bases on avoiding excessive salt penetration. Even though plants require a certain amount of salts to develop, their need ......
The solution of soil erosion
Solution of soil erosion (1) Engineering measures: building terraces, damming and silting land, using earthwork and concrete works, fish scale pits, e ......
CF1304E 1-Trees and Queries(lca+树上前缀和+奇偶性)
题目 二话不说,直接按题意模拟暴搜,当然 \(O(nq)\) 的复杂度显然是寄了的。 不过,在模拟的过程中,我在链式前向星的删边中居然一开始错了,还是要 mark 一下以后注意。 void del(int x, int pre) { e[top].to = e[top].next = 0; h[x] ......
solutions to soil salinisation
1. Test soil for electrical conductance (EC).Salt raises the EC. 2. Make a site-specific management plan.Test for EC in zones radiating out from the b ......
启发式合并,DSU on Tree
启发式合并,DSU on Tree 一、启发式合并 1.1传统启发式合并 启发式合并是做的一个什么事情? 给你\(n\)个集合,令\(s_i = \lbrace i\rbrace\) 选两个集合\(x,y\),把\(y\)里面的元素全部丢到\(x\)里面,令\(s_x = s_x\cup s_y\) ......
A solution to land sailnization
Biologically improved saline-alkali land is barren and soil fertility is poor. Therefore, in the process of transformation, it is an important measure ......
Precise Temperature Control Solutions
Multi-span Temperature Controllers Provide high-performance multi-span temperature controllers to control temperatures across multiple zones or setpoi ......
Solutions to desertification
As global temperatures rise and the human population expands, more of the planet is vulnerable to desertification, the permanent degradation of land t ......
A solution to desertification
What is desertification? Desertification, the process by which natural or human causes reduce the biological productivity of drylands (arid and semiar ......
Planting Trees and Glasses--- Holding Back Soil Erosion
Planting trees and glasses 植树种草 Ganzhou, a typical red soil hilly area in Jiangxi province, is a pilot area for high-quality development of soil and w ......
树状数组(Binary Index Tree)
一、问题引入 Logu P3374 模版题--树状数组。 初始化一个数组,接下来进行若干次以下操作: 单点修改:将某个元素的值进行修改 区间访问:返回该区间的总和 问题分析 如果通过简单索引操作,“1”的时间复杂度为 O(1),“2”的时间复杂度为O(n),其中如果使用一个dp表的方式来存储前n项之 ......
A solution to soil erosion
A specific measure to cope with soil erosion is to increase vegetation cover in China. How it works and its impact : Firstly, vegetation is the first ......
[题解]CFgym103470E Paimon Segment Tree
Paimon Segment Tree 区间加,求一段时间内的区间平方和。 \(n, m, q \le 5 \times 10^4\)。 对时间维差分一下,变成询问区间历史平方和。 离线下来扫描线,扫描线维护时间维,数据结构维护序列维。 考虑维护二元组 \((a, s)\) 表示当前位置值为 \(a ......
A solution to soil erosion
A special measure to cope with soil erosion is to increase vegetation cover in China. Vegetation is the first barrier to protect land from outside. Ta ......
Bioremediation Technology—— A Solution to Soil Pollution
Bioremediation Technology for Soil Polution 1. What is bioremediation technology? Bioremediation is a natural process based remediation technology for ......
CF1381D The Majestic Brown Tree Snake
原题链接 膜拜 APJ 大神。 某人说这个题让他联想到“詹天佑”了。 考虑将图画成——给定链在最上方,不在给出链上的点都相当于挂在这条链上某个点上的树。 有两种情况:一种情况是进入一颗树,在其中完成调头,然后原路返回;还有一种情况是进入一颗树,然后出去的时候走向进来的反方向,然后再倒着回去。 第一种 ......
some solutions for deforestation
Deforestation is a serious problem facing our planet,and it is critical that we find ways to solve it.Forests play a vital role in our ecosystem,provi ......
PAT 1099 Build A Binary Search Tree
1099 Build A Binary Search Tree 30分 题目描述:告诉了BST的结点下标关系、结点值,求BST的层次遍历序列。 vector<int> in; // 保存中序序列 int Tree[105][2]; // 保存结点与左右孩子结点之间的下标 map<int,vector ......
vue 项目使用element ui 中tree组件 check-strictly 用法
属性 check-strictly: 在显示复选框的情况下,是否严格遵循父子互相关联的做法,默c认为 false。 默认false,父子关联。 点击父节点,其下子节点全部统一跟随父节点变化,点击子节点,子节点部分勾选时,父节点处于半选状态。 设置为true,严格遵循父子不互相关联。 就是点击全选的话 ......