Yet Another Convolution
Time limit4sMemory limit512 MB
Given arrays a and b of length n, compute for each k the maximum of |a_i - b_j| over all pairs (i, j) with gcd(i, j) equal to k.
- Level
Hard9 of 10
- Topics
- Number theory, Math, Divide and conquer
- Solved
- No attempts yet
Statement
You are given an integer array and an integer array of length . Compute the array defined as follows:
Input
The first line contains a single integer (). The second line contains integers (). The third line contains integers ().
Output
Output integers .