codeforces segments 1858d trees

Educational Codeforces Round 150 (Rated for Div. 2) C. Ranom Numbers

#include <iostream> #include <string> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const int N=2e5+10; typedef long l ......
Educational Codeforces Numbers Round Rated

Educational Codeforces Round 150 (Rated for Div. 2) B. Keep it Beautiful

#include <iostream> #include <cstring> using namespace std; const int N=2e5+10; int a[N],res[N]; int t; int main(){ cin>>t; while(t--){ int n; cin>>n; ......
Educational Codeforces Beautiful Round Rated

CodeForces 1841C Ranom Numbers

[洛谷传送门](https://www.luogu.com.cn/problem/CF1841C "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1841/C "CF 传送门") 先反转 $s$ 串,然后考虑 dp,设 $f_{ ......
CodeForces Numbers 1841C Ranom 1841

Edgy Trees(dfs,并查集,快速幂,树形结构,红黑树)

Edgy Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree (a conne ......
树形 结构 Trees Edgy dfs

HDU5293 Tree chain problem

# HDU5293 Tree chain problem ## Solution 1 考虑 dp。把链的信息挂在深度最浅的节点上,自下而上更新答案。 记 $f_u$ 表示 $u$ 子树内的最大权值和,$S$ 表示挂在 $u$ 上的某条链,$son(x)$ 表示点 $x$ 的儿子集合,$T_u$ 表示 ......
problem chain 5293 Tree HDU

Educational Codeforces Round 150 (Rated for Div. 2)题解(A~D)

比赛地址 A. Game with Board 题意: 给出一个包含n个1的数组,Alice和Bob轮流操作(Alice先手),每次操作可以将若干个(最少为两个)不同的元素相加,组成一个新的元素插入数组中,同时删去被操作的元素。当轮到某名玩家时无法再进行操作,则该玩家获胜。 思路: 容易想到,当n= ......
题解 Educational Codeforces Round Rated

分数相关:Farey Sequence,Stern-Brocot Tree

## Farey Sequence 记 $n$ 阶 Farey Sequence 为 $L_n$ , $L_n$ 即为集合 $\{\frac{y}{x}\mid (x,y)=1\land1\leq x\leq n\}$ 中的数从小到大写下来,如 $L_5=[\frac01,\frac15,\frac ......
Stern-Brocot 分数 Sequence Brocot Farey

题解 ABC207F【Tree Patrolling】

挺简单的树上背包,就是有点难写。 设 ${dp}_{u,i,x,y}$ 表示仅考虑 $u$ 的子树内,有 $i$ 个节点被控制,$x$ 为节点 $u$ 是否有警卫,$y$ 为节点 $u$ 是否被控制。(其实所有 $x=1,y=0$ 的状态都没用,但我懒得管了。) 每个点 $u$ 的初始值为 ${dp ......
题解 Patrolling 207F Tree ABC

CMU15445 (Fall 2020) 数据库系统 Project#2 - B+ Tree 详解(下篇)

# 前言 上一篇博客中实现了单线程 B+ 树的查找、插入、删除和迭代操作,这篇博客将完成实验二的剩余任务:并发 B+ 树。实现 B+ 树并发访问最简单的方法就是在整棵树上加一把大锁,但是这样会导致过多线程处于阻塞状态,严重降低 B+ 树的性能。这篇博客将使用蟹行协议(crabbing protoco ......
下篇 Project 数据库 数据 系统

Codeforces Round 855 (Div. 3)

`https://codeforces.com/contest/1800` **E. Unforgivable Curse** 题意:输入两个字符串s,t , 每次修改可以交换相距k或k+1位置的字母,能否将将s修改为t。 方法:首先,两个字符串必须由相同元素,且每种元素的个数相等。其次,元素可以先 ......
Codeforces Round 855 Div

【数据库】cmu15445-project2 B+Tree Checkpoint 1 实验总结

project-2相比project-1难度提升了不少。 project2的工作量较大,因此分成两个checkpoint。checkpoint2是支持并发安全,而checkpoint1其实是数据结构的问题,这篇文章先写project-1的checkpoint1。 实验前提 可以看project-2的 ......
Checkpoint project2 project 数据库 数据

CodeForces 1839E Decreasing Game

[洛谷传送门](https://www.luogu.com.cn/problem/CF1839E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1839/E "CF 传送门") 不会,不知道该如何评价。确实是自己的问题。 这种 ......
CodeForces Decreasing 1839E 1839 Game

Educational Codeforces Round 150 (Rated for Div. 2) 题解

https://codeforces.com/contest/1841 https://codeforces.com/contest/1841/problems # D. Pairs of Segments https://codeforces.com/contest/1841/problem/D ......
题解 Educational Codeforces Round Rated

Codeforces Round 877 (Div.2) 题解 A - D

## [A](https://codeforces.com/contest/1838/problem/A). Blackboard List ### 题目大意 起初黑板上有两个数,现在不断选取两个数作出他们俩差的绝对值并写在黑板上,如此往复直到黑板上有 $n$ 个数。现在给定这 $n$ 个数,问起初 ......
题解 Codeforces Round 877 Div

Segment-Anything的一些相关论文总结

1、 Segment Anything Model (SAM) Enhanced Pseudo Labels for Weakly Supervised Semantic Segmentation https://avoid.overfit.cn/post/92f50aa2951d4dd89cfc4 ......
Segment-Anything Anything Segment 论文

Codeforces Round 877 (Div. 2)

# Preface 补题 这场补题的时候直接成腐乳了,A题挂两发,B题挂两发,C题挂一发是真的抽象 虽然D是个套路题看一眼就秒了,但如果真的比赛时候打真要罚时爆炸了的说 后面的EF还是做不来啊岂可修,不过都很有启发性让人感觉神清气爽,不像傻逼蓝桥杯花钱买罪受 # A. Blackboard List ......
Codeforces Round 877 Div

Codeforces Round 876 Div2 A-D题解

# Codeforces Round 876 Div2 A-D题解 # A.The Good Array 这个题就是问你对于 $i \leq n$,要求前面后面至少 $ceil(\frac{i}{k})$ 个 1 那我们就贪心的每k个放一个1,或者直接用数学算一下就好了 AC 代码 ```cpp # ......
题解 Codeforces Round Div2 876

DSU on tree

DSU on Tree DSU on Tree 是指在树上利用类似于并查集的启发式合并的方法处理一类统计的问题。比如这些问题:对于每一个子树T,计算: 1)T中结点的值组成的众数 2)T中不同的结点的值的个数 3)T结点的值从小到大排序后最接近T的根结点的值 以子树中不同的结点的值的个数为例,如果直 ......
tree DSU on

CMU15445 (Fall 2020) 数据库系统 Project#2 - B+ Tree 详解(上篇)

# 前言 考虑到 B+ 树较为复杂,CMU15-445 将 B+ 树实验拆成了两部分,这篇博客将介绍 Checkpoint#1 部分的实现过程,搭配教材 [《DataBase System Concepts》](https://pan.baidu.com/s/15neyE)食用更佳。 # B+ 树索 ......
上篇 Project 数据库 数据 系统

odoo14在tree、kanban视图上添加dashboard

效果图: 实现代码:js:view的类型原来1个js给拆分成了4个: view, controller, renderer, model ​​1、view:AbstractView​​的子类,这是工厂类:类需要解析 ​​arch​​字段并设置其它3个类 2、Renderer :渲染器,来自 ​​Ab ......
视图 dashboard kanban odoo tree

[Codeforces Round 876 (Div. 2)][Codeforces 1839D. Ball Sorting]

题目链接:[D - Ball Sorting](https://codeforces.com/contest/1839/problem/D) 题目大意:需要对一个排列按照指定操作进行排序。操作一:在数字间插入一个特殊点,可执行不超过 $k$ 次;操作二:将在特殊点旁的数移动到任意位置。所有操作结束后 ......
Codeforces Sorting Round 1839 Ball

Codeforces 1188D Make Equal

设最终所有数变为的值为 $u$,$\operatorname{bitcount}(x)$ 为 $x$ 二进制上为 $1$ 的位数,由题可得答案即为 $\sum\limits_{i = 1}^n \operatorname{bitcount}(u - a_i)$。 此时让 $a_i$ 从小到大排序,答 ......
Codeforces 1188D Equal 1188 Make

Codeforces 1626 C

# [1626 C](https://codeforces.com/problemset/problem/1626/C) ## 题意 抽象出题意:给出n个区间的结尾以及它的区间长度,然后每一段连续区间的贡献为$\sum_{i=1}^{len} i$ ,求总贡献。 ## 思路 处理出每个区间的开头结尾 ......
Codeforces 1626

CodeForces 1840G In Search of Truth

[洛谷传送门](https://www.luogu.com.cn/problem/CF1840G2 "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1840/G2 "CF 传送门") 每次询问获得的信息只有当前所在位置的数字。考 ......
CodeForces Search 1840G Truth 1840

Codeforces 1514 C

# [1514 C](https://codeforces.com/problemset/problem/1514/C) ## 题意 给出一个数n,求[1,2,3...n-1]的某个最长子序列,这个子序列的元素乘积模n余1。 ## 思路 这是个思维题,一个数学公式 $$x \equiv 1(mod  ......
Codeforces 1514

Codeforces 1515 B

# [1515 B](https://codeforces.com/contest/1515/problem/D) ## 题意 有n只袜子(n为偶数),但左袜子有L只,右袜子有R只,每只袜子的颜色为$C_i$,可以进行以下操作:换袜子的方向、或者将袜子变色,问进行多少次操作后变成(n/2)对袜子 # ......
Codeforces 1515

Codeforces Round 878 (Div. 3) 题解 A - G2

## 吐槽在前面 太菜了赛后6min过掉的G1,本来以为是因为G1没出没上蓝,结果System Test直接给我C题卡掉了,一看发现我数组开小了一倍,最后险些掉分。 总之就是状况频出的滑铁卢战役qwq。 ## [A](https://codeforces.com/contest/1840/probl ......
题解 Codeforces Round 878 Div

Codeforces Round 876 (Div. 2) 题解 A - D

## [A](https://codeforces.com/contest/1839/problem/A). The Good Array ### 题目大意 给定两个整数 $n$ 和 $k$,规定一个$01$数列为好的的条件是,对于$1\sim n$中任意的 $i$,都有: - $a$ 的前 $i$ ......
题解 Codeforces Round 876 Div

codeforces.com/contest/1553/problem/B

# [简单字符串哈希](https://codeforces.com/contest/1553/problem/B) ## 题意 给一个字符串s和t,问从s的某个位置开始,向右到某个点后再向左,顺序遍历到的字符形成的字符串可否为t。 ## 思路 数据只有500,$O(n^3)$可过,枚举转折点,然后 ......
codeforces contest problem 1553 com

【leetcode】104. Maximum Depth of Binary Tree

给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 **说明:** 叶子节点是指没有子节点的节点。 **示例:** 给定二叉树 `[3,9,20,null,null,15,7]`, ``` 3 / \ 9 20 / \ 15 7 ``` 返回它的最大深度 3 ......
leetcode Maximum Binary Depth Tree