Examination process
The last two digits of the exam, miserable death
After opening title T1 looked, at first glance think it is the longest rising sequence, the kind of linear dp
Then just go to O (n) algorithm, soon heard the voice of the majority keyboarding, more anxious,
In particular, the next person confident action. . . . Then stable state of mind by writing to violence. After writing sample cases did not want to continue
Thinking efficiency exponentially decreases. . . Want to be "counter-attack" on the next man, but still no ideas
There are more than 1h after the sample had not see the problems found, although a look at the sample before but did not grasp every detail
And read the title for a long time before finally going to cull read the T1. . .
Waste 1h30min? ? Suddenly shudders from Western Siberia influx heart. . . . .
Filled with desperate eyes and looked aside and found that after the understanding of the meaning of the title is more a miss,
Since that was clearer brain to think of a fuzzy-half
Showed their wish to achieve write so slowly finished side that had a sample stability, and in the time left 1h excitement finish to beat, then looked at AC100,200 ...
WA up? ? ! ! I kuku, "must open an array of small," I comfort myself, was not found, it took a long time a small point, finally found their own way of thinking is not right dichotomy
what. . . Life ah. . . This is a point I did what ah. .
20 + 0 + 0 embarrassing not avoid, then wrote a T3 violence (not open ll), T2 finish wrote a title puts ( "- 1") .....
T1 finally came up with a weight tree line of thinking has been no time, they look cool moonlight outside the window ........
More to the AFO, the more nonsense.
answer
T1 "dichotomy" "monotonous stack"
First, it is conceivable that the process of calculating ans before every change of pos unchanged
So an array of deposit, then we can just look at the relationship between the height h and the front after the current change of maxh
if h> maxh then this point is to go to the next point, then you need to find the first position is greater than h behind, and len
else go directly to the first> maxh position
We can engage in backwards out: start back from a position of maximum contributions
There is only looking back position is greater than the first h
Thinking on my exam weights segment tree is assigned each time interval, a single point of inquiry
However, monotonic stack bipartite play shorter codes, that is, maintaining a monotonous stack forward from the rear position to ask two separated
T2 "greedy"
Implementation process: First, we have the raw material to create a new warehouse, not a simulation to