跳到正文

zhanglh

726862

zhanglh

在洛谷打开
资料、奖项与版本

资料

编号
726862
抓取

100 AC : \text {100 AC : } CF1027D Mouse Hunt

200 AC : \text {200 AC : } P1516 青蛙的约会

300 AC : \text {300 AC : } P2422 良好的感觉

400 AC : \text {400 AC : } CF1415D XOR-gun

500 AC : \text {500 AC : } P4479 [BJWC2018] 第k大斜率

600 AC : \text {600 AC : } P3295 [SCOI2016] 萌萌哒

700 AC : \text {700 AC : } P4137 Rmq Problem / mex

800 AC : \text {800 AC : } P ?

900 AC : \text {900 AC : } P ?

1000 AC : \large \text {1000 AC : } unknown

共 1 篇
  1. 题解

    EGOI 2024 P2 - Bouquet

    该代码使用动态规划结合树状数组(Fenwick Tree)优化,解决花朵采摘问题。定义 f_i 为前 i 朵花中必须选第 i 朵时的最大采摘数。通过树状数组维护区间最大值,满足两个条件: 查询 j ≤ i - l_i - 1 的最大 f_j 值,确保不与当前花的采摘区间重叠; 延迟更新:在处理完 i 后,将其 f_i 值插入到树状数组的 min(n, i + r_i) 位置,保证后续查询能正确包含该值。 最终通过遍历所有 f_i 得到最大采摘数 ans,时间复杂度为 O(n log n)。

    8 赞