摘要:
"题目" 对于 $1$ 到 $n$ 的一个排列,用 $\mathsf{LIS}$ 表示其最长上升子序列的长度,用 $\mathsf{LDS}$ 表示其最长下降子序列的长度。输出一个使得 $\mathsf{LIS} + \mathsf{LDS}$ 最小的排列。 分析 这道题是 CF Round 502 阅读全文
摘要:
题目大意 给定一个长度为 $n$ 的字符串 $S$,定义函数 $f(S)$ 表示 $S$ 的不同回文子串的个数。对于 $1\le l \le r \le n$,定义 $S[l,r]$ 为字符串 $S$ 的第 $l$ 个字符到第 $r$ 个字符组成的字符串。 求 $\sum_{l= 1}^{n} \s 阅读全文
摘要:
利用回文串的「镜像」特点减少计算。 引理 0 设 $S$ 是一个长度为 $n+1$ 回文串,下标从 $0$ 开始;$T = S[l, r]$ 是 $S$ 的子串。$T$ 是回文串当且仅当 $S[n r, n l]$ 是回文串。 先考虑长度为奇数的回文子串(简称为「奇回文子串」),可以求出以每个下标为 阅读全文
摘要:
$k 0$ 。当 $k$为奇数时, \begin{aligned} \sum_{i = 0}^{k} \binom{n}{i} &= [\binom{n}{0} + \binom{n}{1} ] + [\binom{n}{2} + \binom{n}{3} ] + \dots + [\binom{n 阅读全文
摘要:
For non negative integers $m$ and $n$ and a prime $p$, the following congruence relation holds: $$\binom{m}{n} \equiv \prod_{i=0}^{k} \binom {m_i}{n_i 阅读全文
摘要:
"题目" Analysis 曼哈顿距离($L1$ metric)最小生成树。 Implementation 下面的代码参考了 "gispzjz" 在比赛中的 "提交" 。 c++ include using namespace std; define pb push_back define eb e 阅读全文
摘要:
$\DeclareMathOperator{\lowbit}{lowbit}$ 对于正向树状数组,$a_i$ 表示 区间 $(i \lowbit(i), i]$ 中的信息,对于反向树状数组 $a_i$ 表示区间 $[i, i+\lowbit(i))$ 中的信息。 正向树状数组支持查询区间 $[1,i 阅读全文
摘要:
以某个点为原点,建平面直角坐标系。用从原点发出的射线将平面等分成八个无限的扇形区域 $R_1, R_2, \dots, R_8$ 。 角度区间采用左闭右开的形式。 $R_2\colon [0, \pi/4)$,$R_1 \colon [\pi/4, \pi/2)$,$R_3 \colon [ \pi 阅读全文