pekempey's blog

998244853

Entries from 2019-09-22 to 1 day

AGC038 B - Sorting a Segment

https://atcoder.jp/contests/agc038/tasks/agc038_bRolling hash is useful in this problem. For example, we are given 2013754689 and K=4, then suppose that we are now looking at 20[1375]4689. In this case, we write "1", "3", "5", "7" on the s…

AGC 038 C - LCMs

https://atcoder.jp/contests/agc038/tasks/agc038_cBefore solving this task, solve this problem.\begin{align} f_k = \sum_{\mathrm{gcd}(i, j)=k} a_i b_j. \end{align}We can find this from the following by inclusion-exclusion principle.\begin{a…