A New Sequence
Time limit2sMemory limit512 MB
Given a circular sequence A, compute each b_i as the sum of a_{i+k mod N} weighted by (-1)^k times (k+1) over all k from 0 to N-1.
- Level
Medium7 of 10
- Topics
- Math, Prefix sum, Array, Divide and conquer
- Solved
- No attempts yet
Problem
You are given a sequence of length .
From it, define a new sequence of the same length:
Indices are taken modulo , so is and is . In other words, starts at , walks once around the sequence, and adds each -th element multiplied by .
Given the sequence , compute the sequence .
Input
The first line contains . ()
The second line contains integers separated by spaces. ()
Output
Print the integers of the sequence on one line, separated by spaces.
Only inputs for which holds for every are given.