CF690A3 Collective Mindsets (hard)
Description
Heidi got one brain, thumbs up! But the evening isn't over yet and one more challenge awaits our dauntless agent: after dinner, at precisely midnight, the $ N $ attendees love to play a very risky game...
Every zombie gets a number $ n_{i} $ ( $ 1
Input Format
The first line of input contains a single integer $ T $ ( $ 1
Output Format
For every scenario, output a single integer: the number that the zombie of rank $ R $ shall guess, based on the numbers $ n_{i} $ on his $ N-1 $ fellows' foreheads.
Explanation/Hint
For instance, if there were $ N=2 $ two attendees, a successful strategy could be:
- The zombie of rank 1 always guesses the number he sees on the forehead of the zombie of rank 2.
- The zombie of rank 2 always guesses the opposite of the number he sees on the forehead of the zombie of rank 1.