Greedy Sequence(线段树动态维护区间最大值)

You're given a permutation aa of length nn (1 \le n \le 10^51≤n≤105).

For each i \in [1,n]i∈[1,n], construct a sequence s_isi​ by the following rules:

  1. s_i[1]=isi​[1]=i;
  2. The length of s_isi​ is nn, and for each j \in [2, n]j∈[2,n], s_i[j] \le s_i[j-1]si​[j]≤si​[j−1];
  3. First, we must choose all the possible elements of s_isi​ from permutation aa. If the index of s_i[j]si​[j] in permutation aa is pos[j]pos[j], for each j \ge 2j≥2, |pos[j]-pos[j-1]|\le k∣pos[j]−pos[j−1]∣≤k (1 \le k \le 10^51≤k≤105). And for each s_isi​, every element of s_isi​ must occur in aa at most once.
  4. After we choose all possible elements for s_isi​, if the length of s_isi​ is smaller than nn, the value of every undetermined element of s_isi​ is 00;
  5. For each s_isi​, we must make its weight high enough.

Consider two sequences C = [c_1, c_2, ... c_n]C=[c1​,c2​,...cn​] and D=[d_1, d_2, ..., d_n]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值