Https://training.olinfo.it/#/task/ois_prankster/statement

https://training.olinfo.it/#/task/ois_prankster/statement
I am tried to solve this problem, but not getting more than 15 points(at subtask 3). Can anyone please give me some hints.

OIS 2022 - practical Jokes
Here’s an hint. Please look for similar post before opening a new thread

3 Mi Piace

Thank you for your reply. I am sorry for that. I will be careful about it in future.
Can you please elaborate the hint about difference array.
For example,
5
1 0 1 0 2
how the result will be produced?

Append a 0 at the end of the input so that the difference array is zero iff the original array is zero.

5
1 0 1 0 2 [0]

As the statement suggests, everything should be considered \mod 3. That in mind and the difference array is d = [1, 2, 1, 2, 2, 1].
Suppose the first move adds x=-1 (x = \pm 1 depending on the rotation) to the first three elements: d becomes
d = [1+x, 2, 1, 2-x, 2, 1] = [0, 2, 1, 0, 2, 1]. Two operations to go.

Why all this mess? Consider the second example:

3
1 2 1 [0]

Bonus: S = \sum_i d[i] \mod 3 is invariant under an operation. Why is it always possible to find a solution? Can it be the case that S \not\equiv 0 \mod 3?

2 Mi Piace