20240812

Finished must-be-done items. Let's relax for the rest of the day.

1998B. Minimize Equal Sum Subarrays

As I looked at the number of contestants who solved the problem, it seemed that it was not as difficult as I thought.

Codeforces Round 965 (Div. 2) Editorial

We can always construct a solution such that the number of pairs (i, j) is 1 where the only pair is (1, n).

There exists several constructions, such as rotating p once or increment all pi (and pi = n turns into pi = 1).

Consider the former construction, where q = [p2, p3, ..., pn, p1]. For an arbitrarily interval [i, j], p[i..j] and [i..j] will have exactly 1 element that's different, disregarding ordering.

That totally makes sense now.

"""
one of the possible solutions
"""
for _ in range(int(input())):
    n: int = int(input())
    p: list[int] = list(map(int, input().split()))
    q = [p[-1]] + p[:-1]
    print(" ".join([str(x) for x in q]))

Ketone 0 mg/dl I drank too much water today and I suspect that makes the denominator very large, so that the mg/dl became nearly zero, but not sure

Salad 40g Protein shake 20g

Total carbohydrate 60 g


MUST:

TODO:


index 20240811 20240813