#K74807. Maximum Wi-Fi Signal Strength
Maximum Wi-Fi Signal Strength
Maximum Wi-Fi Signal Strength
You are given n houses arranged in a row, numbered from 0 to n-1. Each house has a Wi-Fi signal generator with a given signal strength. However, due to limitations in the device, each house i can only receive signals from houses within a specific range. In particular, house i can receive the signal from any house in the index range \( [\max(0, i - L_i), \min(n-1, i + R_i)] \), where \( L_i \) and \( R_i \) are the left and right range limits for house i respectively.
Your task is to determine, for each house, the maximum signal strength it can receive from any house in its permitted range.
Note: All indices are considered to be 0-indexed.
inputFormat
The input is read from standard input and consists of the following lines:
- The first line contains a single integer \( n \), the number of houses.
- The second line contains \( n \) space-separated integers representing the Wi-Fi signal strengths for each house.
- The third line contains \( n \) space-separated integers representing the left ranges \( L_i \) for each house.
- The fourth line contains \( n \) space-separated integers representing the right ranges \( R_i \) for each house.
outputFormat
Output a single line to standard output containing \( n \) space-separated integers. The \( i\)-th integer should be the maximum Wi-Fi signal strength received by house \( i \) from any house in its allowed range.
## sample5
2 6 4 8 7
2 1 2 1 3
1 3 1 2 1
6 8 8 8 8