Charging
1000ms 131072K
描述:
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 NN space ships.The NN ships are numbered from 11 to NN and lined up in order.
Xxy has MM charging plans.The i-th plan is describe by two positive integers li,rili,ri.It means in this plan, he will charge the ships numbered from lili to riri.
Xxy will choose some of these plan.If he totally choose tot plans,xx is the number of ships that charged in every plans.Xxy want to maximize the value of min(tot,x)min(tot,x).
输入:
The first line contains two positive integers NN and M(N,M≤300000)M(N,M≤300000).
The next MM lines,each containing two positive integers lili and ri.(li≤ri)ri.(li≤ri)
输出:
The output contains a positive integer. The maximal value of min(tot,x)min(tot,x).
翻译:
xxy是 宇宙之王,为了抵挡武装入侵,他命令建设太空战舰,现在他想收费他的宇宙飞船
他有N艘宇宙飞船,这N艘宇宙飞船标号为从1到N排序整齐,xxy有M种收费计划,第i个计划可以描述为两个正整数li和ri,意味着他将收费的飞船标号从li到ri,xxy将选择某些计划,.如果他完全选择tot计划,x 是每个计划中收费的船舶数量。xxy想计算出费用最少的计划
输入:
第一行包含两个正整数N和M(N,M<=300000)
接下来的M行每行包含两个正整数li和ri(li<=ri)
输出:
输出一个正整数,费用最少的计算结果