Platform Depth
Time limit1sMemory limit1024 MB
For each station i, print the ground height minus the platform height, which is the prefix sum of A minus the prefix sum of B up to i.
- Level
Easy1 of 10
- Topics
- Prefix sum, Implementation
- Solved
- No attempts yet
Problem
A new subway line under construction in Seoul has stations numbered . For each (), station is connected to station .
At station , the ground surface and the platform are both at height m. For each (), moving from station to station raises the ground surface by m and the platform by m. If or is negative, that height drops by its absolute value.
The depth of station is defined as (ground height at station minus platform height at station ). If the platform is above ground, the depth can be negative.
For each (), find the depth of station .
Input
The first line contains . From the second line onward, the -th of the next lines contains and , separated by a space.
Output
Print lines. The -th line () contains the depth of station .
Constraints
All given numbers are integers.
- ()