inversion reverse 154e arc

Atcoder ARC160C Power Up

首先有个很朴素的 DP: 设 $f_{i, j}$ 为有 $j$ 个数 $i$ 能为数 $i + 1$ 产生贡献的方案数和,这个状态的转移方程要好想一些: $f_{i, \frac{j + c_i}{2}} = \sum\limits_{k = j}^{2\times10^5} f_{i - 1, ......
Atcoder Power 160C ARC 160

Atcoder ARC163C Harmonic Mean

首先考虑到分数裂项:$\frac{1}{x} - \frac{1}{x + 1} = \frac{1}{x\times (x + 1)}$,那就有 $\frac{1}{x} = \frac{1}{x + 1} + \frac{1}{x\times (x + 1)}$。 于是构造方法就很明显了啊,首先 ......
Harmonic Atcoder 163C Mean ARC

Atcoder ARC119D Grid Repainting 3

看到方格图,便想到把行和列当成图上的点,把红点当作连接行列的边,这样就能构造出二分图。 考虑把每个连通的二分图单独拎出来考虑,能发现对其建一个生成树,只要 $u$ 节点的操作与 $son_u$ 的操作相反,则 $son_u$ 是不会干扰到 $u$ 的。 这则说明每个连通的二分图消完后肯定是只剩一行或 ......
Repainting Atcoder 119D Grid ARC

Atcoder ARC162C Mex Game on Tree

发现如果子树内如果存在 $k$ 则 $mex$ 的值必定不为 $k$,所以 Bob 的策略即为在空位填上 $k$。 Alice 的决策便可以知道是在 Bob 出手前就要让这个子树满足条件,不让 Bob 破坏这个子树,考虑需满足哪些条件: - 至多 $1$ 个空位,否则 Bob 可以把 $k$ 填在子 ......
Atcoder 162C Game Tree ARC

Atcoder ARC161C Dyed by Majority (Odd Tree)

首先能发现对于树的叶子节点,与其连边的只有其父节点,所以该节点最终状态为 $\text{B/W}$ 其父节点的状态就一定为 $\text{B/W}$。 然后考虑它自己是什么状态,因为同样的与其连边的只有其父节点,所以其父节点最终状态为 $\text{B/W}$ 其状态就为 $\text{B/W}$。 ......
Majority Atcoder 161C Dyed Tree

【ARC104E】Random LIS 题解(期望)

[LG 传送门](https://www.luogu.com.cn/problem/AT_arc104_e) | [AtC 传送门](https://atcoder.jp/contests/arc104/tasks/arc104_e)。 期望。 ## Solution - 显然我们会发现 $n$ 非 ......
题解 Random 104E ARC 104

ARC107F Sum of Abs

# ARC107F Sum of Abs **[题目传送门——洛谷](https://www.luogu.com.cn/problem/AT_arc107_f)** **[题目传送门——AtCoder](https://atcoder.jp/contests/arc107/tasks/arc107_ ......
107F ARC 107 Sum Abs

「CF1637H」Minimize Inversions Number

# 题目 [点这里](https://codeforces.com/problemset/problem/1637/H)看题目。 给定一个 $1\sim n$ 的排列 $p$。 你可以进行下列操作正好一次: - 选定 $p$ 的一个长度为 $k$ 的子序列,并将其按照相同的顺序移动到 $p$ 的最前 ......
Inversions Minimize Number 1637H 1637

[ARC096F] Sweet Alchemy

# [ARC096F] Sweet Alchemy [洛谷:[ARC096F] Sweet Alchemy](https://www.luogu.com.cn/problem/AT_arc096_d) [Atcoder:[ARC096F] Sweet Alchemy](https://atcoder ......
Alchemy Sweet 096F ARC 096

2023-05-02-Stirling-Inversion

abbrlink: '' categories: [] date: '2023-05-02 08:24:16' tags: - 数学 title: Stirling & Stirling Inversion toc: true updated: 2023-5-4T15:7:8.828+8:0 Wai ......

2023-05-02-Unit-Root-Inversion

abbrlink: '' categories: [] date: '2023-05-04T15:37:20.741898+08:00' tags: [] title: Unit Root Inversion toc: true updated: 2023-5-4T15:39:32.503+8:0 ......
Unit-Root-Inversion Inversion 2023 Unit Root

ARC063F题解

[ARC063F](https://www.luogu.com.cn/problem/AT_arc063_d) 白色区域一定是一个矩形。 假设我们已经知道了矩形的两个分界线 ![](https://cdn.luogu.com.cn/upload/image_hosting/d98y1jzi.png? ......
题解 063F ARC 063

ARC133E 题解

# [ARC133E] Cyclic Medians 题解 ## Links [Luogu](https://www.luogu.com.cn/problem/AT_arc133_e) [AtCoder](https://atcoder.jp/contests/arc133/tasks/arc133 ......
题解 133E ARC 133

题解 ARC163C【Harmonic Mean】

没想出来什么优美的解法,来个乱搞。 特判平凡情况 $n\le 2$,其中 $n=1$ 显然有 $1=\frac{1}{1}$,$n=2$ 无解。 众所周知 $1=\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\cdots+\frac{1}{2^k}+\frac{1}{2^k ......
题解 Harmonic 163C Mean ARC

拉格朗日反演公式(Lagrange Inversion)分析证明

$$ w(t)=t\phi(w(t)) $$ $$ [t^n]w^k=\frac{1}{2\pi in}\oint\frac{(w^k)'}{t^n}dt $$ $$ =\frac{1}{2\pi in}\oint\frac{kw^{k-1}\phi(w)^n}{w^n}dw $$ $$ =\fra ......
公式 Inversion Lagrange

AT_arc067_f 题解

[传送门](https://www.luogu.com.cn/problem/AT_arc067_d) ## Simplify 不难想到其实题意就是让你求: $$ \max_{1\le l\le r\le n}\left\{\sum_{i=1}^m\max_{l\le j\le r}\{b_{i,j ......
题解 AT_arc 067 arc AT

「ARC133E」Cyclic Medians 题解

本文网址:https://www.cnblogs.com/zsc985246/p/17513317.html ,转载请注明出处。 ## 传送门 [「ARC133E」Cyclic Medians](https://atcoder.jp/contests/arc133/tasks/arc133_e) # ......
题解 Medians Cyclic 133E ARC

CF1637H Minimize Inversions Number

我直接?????????????????? 考虑一个数怎么做,就是逆序对减去一个 $i$ 前面的逆序对再加上顺序对。考虑很多数怎么做,就是这个玩意的和再加上子序列种的顺序对减去逆序对,顺序对可以用逆序对表示,现在只考虑顺序对。 **注意到**,如果 $ip_j$ 且 $i$ 在子序列中 $j$ 不在 ......
Inversions Minimize Number 1637H 1637

ARC162E Strange Constraints

## 题意 给定长度为 $n$ 的序列 $A$,求序列 $B$ 的个数模 $998244353$,满足以下条件: - 值域 $[1, n]$。 - $i$ 的个数不超过 $A_i$。 - $B_i$ 的个数不超过 $A_i$。 $1 \le n \le 500$。 ## 题解 发现按照某种顺序去构造 ......
Constraints Strange 162E ARC 162

AtCoder Regular Contest 154 E Reverse and Inversion

[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc154_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc154/tasks/arc154_e "AtCoder 传送门") 好题! 考虑如何更 ......
Inversion AtCoder Regular Contest Reverse

B. Reverse Binary Strings

You are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's. String $s$ has exactly $\frac{n}{2} ......
Reverse Strings Binary

ARC162 题解

## A.Ekiden Race (450) 题意:$n$ 个人在进行往返跑比赛,其中第 $i$ 个人在回程前的排名是 $i$,总排名是 $p_i$,问有多少个人可能成为回程中跑得最快的人? 如果对于 $i$,存在某个 $j>i$,使得 $p_j<p_i$,那么 $j$ 在回程途中超过了 $i$,$ ......
题解 ARC 162

ARC114F Permutation Division

## 题意 给定一个 $1 \sim N$ 的排列,Alice 把它划分成 $k$ 段,Bob 把这 $k$ 段任意排列。Alice 想让字典序最小,Bob 想让字典序最大。请问最后的排列。 数据范围: $1\le k\le N\le 2 \times 10^5$。 ## 题解 首先 Bob 的排序 ......
Permutation Division 114F ARC 114

ARC117F Gateau

## 题意 有一个 $2N$ 个位置的圆,每个位置可以放任意多个物品(可以不放)。有 $2N$ 条要求,形如第 $i \sim i+N-1$ 范围内的位置上总共至少有 $A_i$ 个物品($0\le i<2N$,其中第 $j(j\ge 2N)$ 号位置其实是 $j-2N$ 号)。问放置的物品总数至少 ......
Gateau 117F ARC 117

Go进阶32:HTTP-Reverse-Proxy反向代理Nginx硬件指纹校验

One Love - Blue 00:00 / 03:25 https://mojotv.cn/go/hardware-footprint-gui-proxy Go进阶32:HTTP-Reverse-Proxy反向代理Nginx硬件指纹校验 Go&Rust🦀 Go进阶 Go进阶32:HTTP-Re ......

reversed 和 sorted 函数

a = 'abcxd' print(reversed(a)) # <reversed object at 0x000000000356F048> print(list(reversed(a))) # ['d', 'x', 'c', 'b', 'a'] print(sorted(a)) # ['a', ......
函数 reversed sorted

Atcoder ARC071E TrBBnsformBBtion

考虑把所有的 `B` 都变为 `A` 来处理,因为 `A` 和 `B` 是可以互换的,就只需要判断 $s_{a_i\cdots b_i}$ 和 $t_{c_i\cdots d_i}$ 对应的 `A` 的个数能不能在操作后相等。 `A` 的个数前缀和维护即可。 考虑 1 操作,发现其实可以 $1$ 个 ......
TrBBnsformBBtion Atcoder 071E ARC 071

Atcoder ARC100D Equal Cut

发现是 $3$ 个断点且数据范围的 $n\le 2\times 10^5$,根据 2022CSP-S A 留下的心理阴影不难想到可以枚举中间的那个点的同时移动左右两个端点。 考虑如何移动,已知现在在枚举中间的断点 $i$,则现在被分为了两部分 $1\sim i$ 和 $i\sim n$,因为要使极差 ......
Atcoder Equal 100D ARC 100

ARC132E

由于一旦走到头那么这一个后缀/前缀就一定是对应的颜色,所以最终答案形如一段左脚印,一段保留原来的,一段右脚印。 保留原来的段一定是在两个洞之间的一段完整段,考虑枚举这个段,左脚印的数量是确定的,转化成算概率的问题。 这实际上等价于这样一个问题:给 $n$ 个点,每次随机一个点向左/向右,问一直触碰不 ......
132E ARC 132

题解:【ARC142D】 Deterministic Placing

[题目链接](https://www.luogu.com.cn/problem/AT_arc142_d) 大佬讲解的太精简了,做点蒟蒻视角的思考补充。下面记摆放棋子的点为黑点,没有摆放棋子的为白点。 因为进行无数次操作后,占据节点集合总是唯一,所以黑点一定是在反复横跳;每个位置上只能存在一个黑点,所 ......
题解 Deterministic Placing 142D ARC