当前位置: 代码迷 >> 综合 >> Educational Codeforces Round 81 (Rated for Div. 2) E. Permutation Separation(前缀和,线段树)
  详细解决方案

Educational Codeforces Round 81 (Rated for Div. 2) E. Permutation Separation(前缀和,线段树)

热度:83   发布时间:2023-12-09 20:06:10.0

链接: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 2n2?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 1kn?

  相关解决方案