首页 > TAG信息列表 > regulations
ABC214 E - Packing Under Range Regulations(贪心)
目录 Description State Input Output Solution Code Description 有 \(n\) 个小球,每个小球必须在其所在的区间 \([l,r]\),问是否可以放下所有小球 State \(1<=T<=2*10^5\) \(1<=n<=2*10^5\) \(1<=l<=r<=10^9\) Input 2 3 1 2 2 3 3 3 5 1 2 2 3 3 3 1 3 999999999 10000G9U4 Explaining rules and regulations
General English9 Unit4 Health and Safety Explaining rules and regulations Vocabulary Rules,regulations and laws JAKE:Oh,man,This is gonna be awesome. SIMON:Burgers taste so much better when they've been barbecued. JAKE:Yup.That's a fact. SIMOabc214_e Packing Under Range Regulations
题目链接 题目大意 给你n个区间,让你每个区间选一个数,选的数不能重复。 解题思路 看到题的第一眼肯定是想大力贪。怎么贪呢?对于每个区间来说,尽可能的选靠左或者靠右的数?好像都不太对的样子。 我们考虑将所有区间的左端点排序,然后用一个指针从最小的左端点往右移,每存在