Bell (Bell)
InterviewTime limit2sMemory limit1024 MB
Given sorted bell positions and house positions, print for each house K minus the distance to the nearest bell, clamped at 0.
- Level
Easy3 of 10
- Topics
- Binary search, Array
- Solved
- No attempts yet
Problem
JOI City has one road that is long enough to be treated as a number line. Each point on the road is given by a single real coordinate.
Along this road, JOI City has bells, numbered from to in increasing order of coordinate. Bell () is at coordinate .
At the end of each year, JOI City rings all of these bells at once. This is a major event for the city.
When a bell is rung, it sounds with strength at its own location. The strength drops by for every unit of distance from the bell, and it becomes at distance or more. So when bell is rung, the strength of its sound at coordinate is , where is the absolute value of .
When all the bells are rung, the strength of the bell sound at coordinate is the maximum of the sound strengths that each bell produces at .
JOI City has houses along this road, numbered from to in order of age, with the oldest first. House () is at coordinate .
As the mayor of JOI City, you want to know the strength of the bell sound heard at each house when all the bells are rung.
Given the bell and house information for JOI City, write a program that computes the strength of the bell sound heard at coordinates when all the bells are rung.
Input
The input is given in the following format.
N M K
A_1 A_2 \ldots A_N
B_1 B_2 \ldots B_M
Output
Output lines. On line (), print the strength of the bell sound heard at coordinate when all the bells are rung.
Constraints
- .
- .
- .
- ().
- ().
- ().
- ().
- All input values are integers.