当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3245:Sequence Partitioning

题目描述

Given a sequence of N ordered pairs of positive integers (Ai, Bi), you have to partition it into several contiguous parts. Let p be the number of these parts, whose boundaries are (l1, r1), (l2, r2), ... ,(lp, rp), which satisfy li = ri − 1 + 1, li ri, l1 = 1, rp = n. The parts themselves also satisfy the following restrictions:

  1. For any two pairs (Ap, Bp), (Aq, Bq), where (Ap, Bp) is belongs to the Tpth part and (Aq, Bq) the Tqth part. If Tp < Tq, then Bp > Aq.

  2. Let Mi be the maximum A-component of elements in the ith part, say

    Mi = max{Ali, Ali+1, ..., Ari}, 1 ≤ ip

    it is provided that

    __poj_jax_start__\sum_{i=1}^pM_i\leq\mathrm{Limit}__poj_jax_end__

    where Limit is a given integer.

Let Si be the sum of B-components of elements in the ith part. Now I want to minimize the value

max{Si:1 ≤ i ≤ p}

Could you tell me the minimum?

输入解释

The input contains exactly one test case. The first line of input contains two positive integers N (N ≤ 50000), Limit (Limit ≤ 231-1). Then follow N lines each contains a positive integers pair (A, B). It's always guaranteed that

max{A1, A2, ..., An} ≤ Limit
__poj_jax_start__\sum_{i=1}^nB_i\leq2^{31}-1__poj_jax_end__
输出解释
Output the minimum target value.
输入样例
4 6
4 3
3 5
2 5
2 4
输出样例
9
提示
An available assignment is the first two pairs are assigned into the first part and the last two pairs are assigned into the second part. Then B1 > A3, B1 > A4, B2 > A3, B2 > A4, max{A1, A2}+max{A3, A4} ≤ 6, and minimum max{B1+B2, B3+B4}=9.
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 5000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3245

最后修改于 2020-10-29T06:56:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000 65536