407239: GYM102700 I Incredible photography
Description
The photography contest for the UNAL portfolio cover page is nearly over and Paula, as a big fan of photography, is worried since she still does not have a great picture to participate with. This is because this semester has been unusually harder than the previous one.
Paula is a fit girl. She usually goes to the GYM to be in shape but it seems that today she won't be able to go. That's why she decided that while she will be looking for the best picture, she will try to walk as much as she can.
Paula thinks that the best photo she can take will be at the top of some building. And she considers that it's not necessary to take a photo in a building whose height is less or equal than the height of the building where she is right now.
After Paula takes pictures at the top of a building, she chooses the next building to visit to take more photos. Naturally, she will choose only among the buildings that she is able to see. A building is in Paula's sight if and only if there is no other strictly higher building in between.
All Buildings in the UNAL are located in a single line, one after another. The distance that she is going to walk from one building to another is the absolute difference between the positions of the buildings in the line e.g. to go from building $$$i$$$ to building $$$j$$$ she needs to walk $$$|i-j|$$$ distance.
Paula is planning at which building she should start taking pictures. That's why she wants to know, for each building, what is the maximum distance she would walk if she starts to take pictures in that building. Can you help Paula with that?
InputThe first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — The number of buildings.
The following line will contain $$$n$$$ integers ($$$1 \le h_i \le 10^9$$$) — The height of the $$$i$$$-th building.
OutputPrint $$$n$$$ numbers on a line. The $$$i$$$-th number is the maximum distance Paula would walk if she starts taking pictures at building $$$i$$$.
ExamplesInput4 3 1 2 4Output
3 6 5 0Input
1 15Output
0Input
5 3 3 1 5 5Output
4 3 6 0 0