链接:Educational Codeforces Round 81 (Rated for Div. 2) E. Permutation Separation
题意
给出一个 1 1 1 ~ n n n( 2 ≤ n ≤ 2 ? 1 0 5 2\le n\le 2\cdot 10^5 2≤n≤2?105)的排列 p 1 , p 2 , ? ? , p n p_1,p_2,\cdots,p_n p1?,p2?,?,pn?,选择 k k k并将序列分为左右两个集合 p 1 , p 2 , ? ? , p k p_1,p_2,\cdots,p_k p1?,p2?,?,pk?和 p k + 1 , p k + 2 , ? ? , p n p_{k+1},p_{k+2},\cdots,p_n pk+1?,pk+2?,?,pn?( 1 ≤ k ≤ n ? 1 1\le k\le n-1 1≤k≤n?