摘要: [[This is a tag]] 建图,然后在图上使用一种遍历策略来输出一种遍历顺序,构造出了答案序列 虽然链表似乎也可以,但是建图简单得多 #include<bits/stdc++.h> using namespace std; const int N=100005; int n,T,a,b[N 阅读全文
posted @ 2022-12-11 11:51 -WD- 阅读(67) 评论(0) 推荐(0)
摘要: [[inverse element]] link: E - Balance Addicts 虽然说CF上有DP标签,但是不能算完全意义上的DP,可以不通过DP来理解 就是在到 $i$ 的前缀和 和 到 $j$ 的后缀和相同时做处理 如果没有0就是每次找到直接ans*=2 现在有0就复杂一点,两边能分 阅读全文
posted @ 2022-12-11 11:50 -WD- 阅读(79) 评论(1) 推荐(1)
摘要: date: 2022-10-21 div1 这是一场VP 过了两题,阻力很大,都调了很久,结果一看一道1600,一道1700 还是得画草稿,要写清楚每个数组的含义 [[DP]] link: A - Tokitsukaze and Strange Inequality 一眼就能看出是DP,然后 根据这 阅读全文
posted @ 2022-12-11 11:49 -WD- 阅读(71) 评论(0) 推荐(0)
摘要: [[Dijkstra]] [[Game theory]] [[DP]] link CF原题 先用dijkstra预处理两个点到所有点的最短距离 然后就能用两个距离来描述一个点了 对于两个最短路相等的点,实际上他们没有差别,可以直接合并 由于两个数表示一个点,可以离散化之后,直接建一个坐标系(一个矩阵 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(62) 评论(0) 推荐(0)
摘要: [[math]] [[matrices]] [[fast_exponentiation]] link Consider ignoring the modulo, then calculate at the same time. $$ \begin{aligned} dx&=x+y+dx+t\ dy& 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(62) 评论(0) 推荐(0)
摘要: #my [[two pointers]] [[LCA]] [[DFS Tour & Euler Tour]] [[map]] This problem took me three nights. Calculate the longest length of interval of indices 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(70) 评论(0) 推荐(0)
摘要: #my [[interval DP]] link Pro Calculate the number of states(interval sequence) meet following conditions: Each interval does not belong to any other i 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(63) 评论(0) 推荐(0)
摘要: [[Centroid Decomposition]] link Build the centroid tree Precalculate the distances from the centroids to every node in their subtrees, for adding mark 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(66) 评论(0) 推荐(0)
摘要: #my [[math]] link First, it's obvious that the numbers put can be only 1 or -1. If k equals to -1 and the parity of n and m differ, the answer is obvi 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(78) 评论(0) 推荐(0)
摘要: #my [[dfs]] [[Base Ring Tree]] link At first, I felt confused about the description. calculate the number of simple paths in a completed binary tree w 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(74) 评论(0) 推荐(0)
摘要: [[interactive]] [[Divide and Conquer]] link We are allowed to query 15 times, and n<1000. Obviously, use ==divide and conquer== algorithm. A small con 阅读全文
posted @ 2022-12-11 11:48 -WD- 阅读(73) 评论(0) 推荐(0)
摘要: #my [[discretization]] [[SA]] [[RMQ]] [[Binary Search]] [[Sweep Line]] [[BIT]] [[difference]] link OHHHHH OHHHH OHHHHHHHHH I made it!!!! ![[Pasted ima 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(68) 评论(0) 推荐(0)
摘要: date: 2022-11-14 %% CodeChef上的题号就是一串 Problem Code ,所以我就这样记了 吐槽: AK DIV4 再加1题就AK DIV1了 CodeChef的四个div的题目高度重合 %% [[bitmasks]] [[division]] 因为有一个情况没考虑到,昨 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(74) 评论(0) 推荐(0)
摘要: [[Constructive Algorithms]] #include<bits/stdc++.h> using namespace std; const int N=200005; int n,a[N],T,tp; vector<pair<int,int>>x; #define pb push_ 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(30) 评论(0) 推荐(0)
摘要: date: 2022-12-06 第一道AGC 这很可能是我的的最后几题之一了 [[This is a tag]] A - My Last ABC Problem 赛时直接卡住,还好QY明智地提早开了unrated 先考虑一段区间,然后发现选一段区间进行转换等价于剩下的一部分进行转化 所以可以把询问 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(69) 评论(0) 推荐(0)
摘要: date: 2022-11-05 [[Segment Tree]] [[Expectation]] My Sol. 先是我的做法 把max函数拆掉:$\max{x,y}=\frac{1}{2}*(x+y+|x-y|)$ 然后我们的 $x$ 和 $y$ 是在同一个序列 $A$ 里取的 所以转化一下答案 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(59) 评论(0) 推荐(0)
摘要: date: 2022-10-23 alias: P6062 #template [[Hungarian Algorithm]] 每个点可能在两个方向上的木板上, 所以可以转化为二分图,一块尽可能大的木板看作一个点,两个方向上的木板是天然的两个集合 点转化为两块木板间的边,现在就能转化为一个二分图了 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(59) 评论(0) 推荐(0)
摘要: date: 2022-10-27 [[discretization]] [[difference]] link 一条鱼相当于一个向量,记一个初始点,一个速度 那么我们可以 $O(n^2)$ 算出任何两条鱼距离为 len 的时间区间(定一条鱼在最前面) 不妨让网的边界放在鱼上,那么我们对每条鱼就是求这 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(66) 评论(0) 推荐(0)
摘要: date: 2022-10-23 [[Bitmask DP]] link: E - Booster 看到这么小的数据量,就知道这是个状压DP了 状态 $f_{i,D}$ 表示当前在点 $i$ ,已经到过了集合 $D$ 时的最短时间 转移方式是每次多到一个点,所以可以用BFS实现,每次扩展一层就是多到 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(72) 评论(0) 推荐(0)
摘要: date: 2022-10-23 %% 今年第一次打AT,切5题 之后就没时间了 G是原题,没时间贺了 %% [[set]] [[DP]] link: D - Robot Arms 2 xy轴分开考虑,考虑两个相似的DP 数据波动小(1~10),看起来状态数很少,所以直接上了set表示状态,可以自动 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(65) 评论(0) 推荐(0)
摘要: link [[Sweep Line]] [[Segment Tree]] [[math]] This will go over the basic outline for solution. The first thing to note, is that, if you interpret the 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(72) 评论(0) 推荐(0)
摘要: [[DP]] [[two pointers]] link A hint: There is near 3000000 numbers with maximal prime divisor <=100. According to the hint, we can list all the passib 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(69) 评论(0) 推荐(0)
摘要: #my [[SAM]] link 他想问"有多少$s$的子串与给定的字符串$x$循环同构" 给定字符串$s$和n个字符串$x_i$,对于每个字符串$x_i$找到,$s$中有多少连续的子字符串与$x_i$循环同构。 %%> So he wants to ask "how many consecutiv 阅读全文
posted @ 2022-12-11 11:47 -WD- 阅读(65) 评论(0) 推荐(0)