P4352 [CERC2015] Greenhouse Growth

题目描述

You are switching from computer science to agriculture and your new job involves growing sunflowers in an underground greenhouse. The greenhouse contains n sunflower plants arranged in a straight line and numbered with integers 1 through n, from left to right. Two lamps provide the light and heat the sunflowers need to grow: the lamp A is positioned at the left end, while the lamp B is positioned at the right end of the line. Every day exactly one of the lamps is on, causing all of the sunflowers to turn towards the light and some of them to grow. The sunflower will grow if and only if the sunflower directly in front of it (towards the light) is higher. The growth is continuous with a uniform rate of exactly 1 centimeter per day. Notice that, when a sunflower starts to grow, it may cause the sunflower directly behind it to start to grow instantaneously. ![](https://cdn.luogu.com.cn/upload/pic/16238.png ) You are given initial heights of the sunflowers and the lamp schedule for the following m day period, find the final heights of all the sunflowers.

输入格式

输出格式

说明/提示

Central Europe Regional Contest 2015 Problem G