链接:https://codeforces.ml/contest/1341/problem/B
On February 14, Denis decided to give a Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length kk (k≥3k≥3). Nastya was very confused by this present, so she decided to break the door, throwing it on the mountains.
Mountains are described by a sequence of heights a1,a2,…,ana1,a2,…,an in order from left to right (k≤nk≤n). It is guaranteed that neighboring heights are not equal to each other (that is, ai≠ai+1ai≠ai+1 for all ii from 11 to n−1n−1).
Peaks of mountains on the segment [l,r][l,r] (from ll to rr) are called indexes ii such that l<i<rl<i<r, ai−1<aiai−1<ai and ai>ai+1ai>ai+1. It is worth noting that the boundary indexes ll and rr for the segment are not peaks. For example, if n=8n=8 and a=[3,1,4,1,5,9,2,6]a=[3,1