codeforces segments 1858d trees

Educational Codeforces Round 148 (Rated for Div. 2) A~E

## Educational Codeforces Round 148 (Rated for Div. 2) A~E ### A. New Palindrome 对于奇回文串不能统计中心的字符,然后判断是否有不同的字符 ```c++ void work() { string s; cin >> s; ......
Educational Codeforces Round Rated 148

CF1774G Segment Covering【性质】

给定 $ n $ 个区间 $ [x_i, y_i] $,保证所有区间均不同。令 $ f(l, r) $ 表示从 $ n $ 个区间中选择偶数个区间使得其并集恰为 $ [l, r] $ 的方案数,$ g(l, r) $ 表示从 $ n $ 个区间中选择奇数个区间使得其并集恰为 $ [l, r] $ 的 ......
Covering 性质 Segment 1774G 1774

Codeforces Round 874 (Div. 3) A-G

[比赛地址](https://codeforces.com/contest/1833) ## A. Musical Puzzle 题意:给出一个字符串,求有多少个不同的长度为2的子串 ### Solution 直接set存即可 ```C++ void solve() { int n;cin>>n; ......
Codeforces Round 874 A-G Div

Codeforces Round 874 (Div. 3)

# [A.Musical Puzzle](https://codeforces.com/contest/1833/problem/A "A.Musical Puzzle") ### 题意: 用最少的长度为2的字符串按一定规则拼出s。规则是:前一个字符串的尾与后一个字符串的首相同。 ### 分析: 统 ......
Codeforces Round 874 Div

【题解】CF193D Two Segments

## 题意 给定一个$1\sim N$的排列,在这个排列中选出两段互不重叠的区间,求使选出的元素排序后构成公差为1的等差数列的方案数。选出的两段区间中元素构成的集合相同时视为同一种方案。$1\le N\le 3\times 10^5$。 [传送门](https://www.luogu.com.cn/ ......
题解 Segments 193D 193 Two

CodeForces1061C Multiplicity

## 题面翻译 从序列 $\{a_1,\ a_2,\ ..\ ,\ a_n\}$ 中选出**非空**子序列 $\{b_1,\ b_2,\ ..\ ,\ b_k\}$,一个子序列合法需要满足 $\forall\ i \in [1,\ k],\ i\ |\ b_i$。求有多少互不相等的合法子序列,答案对 ......
Multiplicity CodeForces 1061C 1061

Codeforces 874 div3 (A-G)

# [Codeforces 874 div3](https://codeforces.com/contest/1833) ## A ### 题意 计算每两个相邻字符的不同种类 ## B ### 题意 重排一个数组b,使得$|a_i-b_i|\leq k$ ### 思路 根据相对大小去一一对应,这样每 ......
Codeforces div3 874 A-G div

1102 Invert a Binary Tree

题目: The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree ......
Invert Binary 1102 Tree

1086 Tree Traversals Again

题目: An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with ......
Traversals Again 1086 Tree

【做题记录】CodeForces343D Water Tree

题面翻译 - 给出一棵以 $1$ 为根节点的 $n$ 个节点的有根树。每个点有一个权值,初始为 $0$。 - $m$ 次操作。操作有 $3$ 种: 1. 将点 $u$ 和其子树上的所有节点的权值改为 $1$。 2. 将点 $u$ 到 $1$ 的路径上的所有节点的权值改为 $0$。 3. 询问点 $u ......
CodeForces Water 343D Tree 343

Codeforces 1827E - Bus Routes(思维)

一道比较诈骗的题,放在现场最大的挑战在于做完 B2 C D 这三道不算太签的题以后还有时间开这个题。 首先特判 $n=2$。以任意一个不是叶子的点为根。那么一棵树合法,当且仅当其中所有叶子都能在 $2$ 步内互相到达,因为如果一对不能在 $2$ 步内互相到达的点 $(u,v)$ 中存在至少一个不是叶 ......
Codeforces 思维 Routes 1827E 1827

Greenplum数据库中segment故障检测

1.Greenplum数据库中segment故障检测 1.1概述 Greenplum数据库服务器(Postgres)有一个子进程,该子进程为ftsprobe,主要作用是处理故障检测。 ftsprobe 监视Greenplum数据库阵列,它以可以配置的间隔连接并扫描所有segment和数据库进程。 如 ......
Greenplum 故障 segment 数据库 数据

Codeforces Round 873 (Div. 2)

Codeforces Round 873 (Div. 2) 链接 Codeforces Round 873 (Div. 2) A题 打印2-n并且计算总和,然后找到严格大于sum的n的倍数记为x,然后用这个x减去sum得到a. 然后先打印a然后再打印2-n #include <iostream> # ......
Codeforces Round 873 Div

Codeforces Round 767 (Div. 1) E. Groceries in Meteor Town (Kruskal重构树 + 线段树)

传送门 ** 出现最大路径权值就应该联想到克鲁斯卡尔重构树,我们对于克鲁斯卡尔重构树求一遍dfs序,维护所有白色点的最大最小dfn(包括出发点),求出最大最小dfn的最近公共祖先既是答案。注意需要特判一下除了本身以外没有白色点情况。** #include <bits/stdc++.h> int n, ......
线段 Codeforces Groceries Kruskal Meteor

Codeforces Round 873 A~E

Codeforces Round 873 (Div.1) A. Counting Orders 对于每个 $a_i$,可以计算出 $c_i$ 表示有多少个 $b_j\lt a_i$。 那么第 $i$ 个人就有 $c_i$ 种可能的位置。 注意到如果将 $a$ 升序排序,则能放的位置集合从前往后是包含 ......
Codeforces Round 873

CodeForces 1827 D Two Centroids

洛谷传送门 CF 传送门 考虑固定一个重心,设 $k$ 为重心最大子树大小,答案为 $n - 2k$。构造方法是往最大的子树塞叶子。 树的重心有一个很好的性质,就是加一个叶子,重心最多移动一条边的距离。简单证一下,设重心为 $x$,往儿子 $u$ 的子树中加叶子。 如果 $sz_u > \left\ ......
CodeForces Centroids 1827 Two

Educational Codeforces Round 148 (Rated for Div. 2) A-D2

Educational Codeforces Round 148 (Rated for Div. 2) A. New Palindrome map<int,int>mp; void solve(){ string s; mp.clear(); cin>>s; for(int i=0;i<s.size ......
Educational Codeforces Round Rated 148

CodeForces 1827 B Range Sorting

洛谷传送门 CF 传送门 考虑拆贡献 $i - 1 \sim i$,发现当 $[1, i - 1]$ 的最大值大于 $[i, n]$ 的最小值时 $i - 1 \sim i$ 产生 $1$ 的贡献。 考虑枚举左端点 $j$,设 $x = \max\limits_{k=j}^{i-1} a_k$。设 ......
CodeForces Sorting Range 1827

记录elementUIPlus el-tree-select 懒加载和是否需要leaf

1 <el-tree-select style="width: 100%" :load="loadNode" :default-expanded-keys="state.defaultExpandedKeys" 2 :props="state.treePathProps" value-key="id ......

Codeforces Round 872 (Div. 2)

Preface 怎么感觉越来越菜了现在,拿个小号打Div2都被血虐 C题一个Corner Case没写好直接爆炸,本来10min秒切的愣是搞到最后用对拍才看出来 本来D2和E都很有思路的说,结果都来不及写了苦路西 不过换着想还好是小号,不然直接又俯冲蓝名了 A. LuoTianyi and the ......
Codeforces Round 872 Div

Codeforces Round 872 (Div. 2) A-D

比赛地址 A. LuoTianyi and the Palindrome String 题意:给一个回文串,求最长的非回文子串的长度 Solution 判一下回文串是不是由相同的字母组成的,如果是的那么无解,如果不是答案就是len-1 void solve() { string s;cin>>s; ......
Codeforces Round 872 A-D Div

el-tree如何拿到所有节点,以及如何控制收起所有节点?

取所有节点:this.$refs...root.childeNodes 收起节点:expanded = false 收起全部节点思路 将所有节点的expanded设置为false即可。 实例 html <el-tree ref="myTree" ... ></el-tree> js for (let ......
节点 el-tree tree el

Codeforces Round 871 (Div. 4) A-H

Codeforces Round 871 (Div. 4) A. Love Story string t="codeforces"; void solve(){ string s; cin>>s; int ans=0; for(int i=0;i<10;i++){ if(s[i]!=t[i])ans ......
Codeforces Round 871 A-H Div

Codeforces Round 872 (Div. 1 & Div. 2)

这场寄大了。 My predictor say -101pts。 https://codeforces.com/contest/1824 https://codeforces.com/contest/1825 2A. LuoTianyi and the Palindrome String 因为给出的 ......
Codeforces Div Round 872 amp

Codeforces Round 871 (Div. 4)

A. Love Story #include<bits/stdc++.h> using namespace std; #define int long long int read() { int x = 0, f = 1, ch = getchar(); while ((ch < '0' || ch ......
Codeforces Round 871 Div

解决git错误: error: The following untracked working tree files would be overwritten by merge

在我本地上进行git pull的时候,出现这个错误: error: The following untracked working tree files would be overwritten by merge: config/config.php 这是因为,本地上有一个文件,没有被git管理,但 ......

Codeforces Round 871 (Div. 4)

A.Love Story 题意: 给定n个长度为10的字符串,问其与codeforces字符串的对应下标字母不同的个数。 分析: 对于每个字符串从前往后依次和“codeforces”对应字符比较然后统计不同字母数即可 code: #include <bits/stdc++.h> using name ......
Codeforces Round 871 Div

2021-2022年度国际大学生程序设计竞赛第10届陕西省程序设计竞赛(正式赛)A-Tree

官方题解:https://blog.csdn.net/qq_62464995/article/details/127493921 题目大意 给出一棵边权为1的树,构造排列p,使得 ①p[1]=1 ②dis(p[i],p[i+1])<=k 题解 神必防ak题 当k=1时,显然只能是从1开始的一条链 当 ......
程序设计 程序 年度 大学生 A-Tree

ABC133F Colorful Tree

题意 考虑把查询拆成一端点为 $1$ 的 $3$ 个查询。 那么要维护一个点 $x$ 到 $1$ 号点的路径长度,某种颜色的边权和与出现数量。 这个显然可以用可持久化线段树维护,时间复杂度 $O((n + q)\log n$,空间 $O(n\log n)$。 ......
Colorful 133F Tree ABC 133

K-D Tree模板/P4169 [Violet]天使玩偶/SJY摆棋子

$\color{purple}\text{P4169 [Violet]天使玩偶/SJY摆棋子}$ 以本题为例题讲解模板怎么写。 思路 $\text{K-D Tree}$ 是一种类二叉查找树,不过元素是多维的,所以每次对于子树的划分也是依据不同维度的。 本题使用二维的 $\text{K-D Tree} ......
棋子 玩偶 模板 天使 Violet