Official
This problem does not require fewer insights than other problems with similar difficulties. Compute it carefully!
Overall Editorial by evima
HintsA - +3 +5 +7
Hint 1
What only matters is the differences between the three integers. In other words, let $c$ be a constant number, and we may add $c$ to the initial values of $x_i$ or consider a $(+3+c, +5+c, +7+c)$ operation instead of $(+3, +5, +7)$.Hint 2
I think $(-2, +0, +2)$ is a good choice. In this case, $x_1+x_2+x_3$ is constant, and we can compute the values of $x_1,x_2,x_3$ when the objective is achieved.Editorial → https://atcoder.jp/contests/arc158/editorial/5952
B - Sum-Product Ratio
Hint 1
Let us fix, for example, $x_i$ and $x_j$, and consider the optimal values for $x_k$.Hint 2
For fixed $x_i$ and $x_j$, we can write $(x_i+x_j+x_k)/x_ix_jx_k$ as $(a+x_k)/bx_k = (a/b)\cdot (1/x_k) + (1/b)$ for some constant numbers $a$ and $b$.Hint 3
After narrowing down the candidates for the optimal solutions, we can use brute force.Editorial → https://atcoder.jp/contests/arc158/editorial/5953
C - All Pair Digit Sums
Hint 1
Let $k$ be the number of carries when computing $x+y$, and we have $f(x+y) = f(x) + f(y) - 9k$.Hint 2
From Hint 1, the problem can be reduced to compute the total number of carries when computing all $A_i+A_j$. Let us compute it for each digit position.Editorial → https://atcoder.jp/contests/arc158/editorial/5981
D - Equation
Hint 1
Exploit the characteristics of both sides: they are homogeneous polynomials, where all terms have the same degree.Hint 2
For some fixed ratio of $x, y, z$, there is often exactly one solution.Editorial → https://atcoder.jp/contests/arc158/editorial/5983
E - All Pair Shortest Paths
Hint 1
In this type of problem where you are asked to find the sum of something over all subsegments $[L,R)$, we have the following two basic strategies. 1. Maintain the answers for all $L$ in some way and increase $R$. 2. Use divide-and-conquer to reduce the problem to the case with a segment that straddles the middle. Both are possible in this problem.This problem does not require fewer insights than other problems with similar difficulties. Compute it carefully!
Editorial → https://atcoder.jp/contests/arc158/editorial/5984
F - Random Radix Sort
Hint 1
It is necessary and sufficient that each $B_{i+1}$ is to the right of $B_{i+1}$. Sort out the requirements for each $i$.Hint 2
It only matters when each digit is moved the last time. The problem is reduced to one similar to counting permutations.Editorial → https://atcoder.jp/contests/arc158/editorial/5985
posted:
last update: