英文原题:题目来源:Charging | JXNUOJ
Charging
1000ms131072K
描述:
Xxy is the king of the universe. In order to resist the invasion, he ordered the construction of many space warships.Now,he wants to charge his space ships.
He has N space ships.The N ships are numbered from1 to N and lined up in order.
Xxy has M charging plans.The i-th plan is describe by two positive integers li,ri.It means in this plan, he will charge the ships numbered from li to ri.
Xxy will choose some of these plan.If he totally choose tot plans,x is the number of ships that charged in every plans.Xxy want to maximize the value of min(tot,x).
输入:
The first line contains two positive integers N and M(N,M≤300000).
The next M lines,each containing two positive integers li and ri.(li≤ri)
输出:
The output contains a positive integer. The maximal value of min(tot,x).
翻译:
充能
描述:
Xxy 是银河帝国的皇帝。为了抵抗亚空间恶魔入侵,他下令建造了了很多的战舰。现在他想给自己的舰队充能。
他有N艘战舰,其中每艘战舰的编号分别由1到N。
Xxy 有M个充能计划,其中第i个计划将会由 li 和 ri 这两个整数描述。也就是说在这个计划中他会让编号li到ri的战舰进入擎天堡充能。
Xxy 将会选择一些计划,如果他完全选择了 tot 个计划,其中 x 表示每个计划充能的战舰的数量。
Xxy 想要得到最大的min(tot,x)的值。
输入:
第一行输入两个整数 N 和 M(N,M≤300000)。
接下来的M行每行输入两个整数 li 和 ri 。( li <= ri )
输出:
输出一个整数,表示最大的min(tot,x)。(所有min(tot,x)最大的那个)