arc098_b: Xor Sum 2

By case discussion, we can see that we can treat each bit independently. For each bit, we can just caluate the last 0 to the left of it, and the add the min distance from all last 0 to the answer

arc098_c: Range Minimum Queries

Lets fix X first and discuss cases!!!

Extreme case: suppose X is the min value of whole array, to optimize the target value, we just pick the min Q values

Now suppose, we try all possible X values, then we can separate the array into bands, each of which has value >= X, and then we combine all bands with length >= K, sort the combined band, and take the top 1 and Q entries. Note if we have < Q entries, the the X value is too big.

agc025_b: RGB Coloring

We can view the combination as painting two colors independently, i.e., A * a + B * b = K. So for each a, we have a fixed b. This means, for each a, we have a fixed b, and introduces (n choose a) * (n choose b) ways.