| acmsguru |
|---|
| Finished |
if either ai > ai-1 and ai > ai+1 (local maximum) or ai < ai-1 and ai < ai+1 (local minimum). A sequence p1, p2, ·s, pn is called a
of the integers from 1 to n if each of the integers appears in the sequence exactly once. A permutation is called
if each member (except the first and the last) is a local extreme.
) and m (1 ≤ m ≤ 109). sample input | sample output |
3 10 | 4 |
sample input | sample output |
3 3 | 1 |
| Name |
|---|


