「CF1295」Permutation Separation

#1295E. Permutation Separation

Summarize

给定一个 $1-n$ 的排列。将该排列划分为非空的前后缀,要求在两个集合间移动一些元素,其中移动第 $i$ 个元素的代价为 $a_i$,使得在前缀集合中的所有元素均小于后缀集合中的任意元素。

$n\le 2e5,a_i\le 1e9$

「CF1295」Same GCDs

#1295D. Same GCDs

Summarize

给定正整数 $a$,$m$($a<m$)。计算符合条件的 $x\in[0,m)$ 的个数,使得 $\text{gcd}(a,m)=\text{gcd}(a+x,m)$。

$a\le 1e10,m\le 1e10$

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×