Sunscreen POJ - 3614(防曬油) 貪心-優先佇列
To avoid unsightly burns while tanning, each of the C (1 ≤ C ≤ 2500) cows must cover her hide with sunscreen when they’re at the beach. Cow i has a minimum and maximum SPF rating (1 ≤ minSPFi ≤ 1,000; minSPFi ≤maxSPFi ≤ 1,000) that will work. If the SPF rating is too low, the cow
suffers sunburn; if the SPF rating is too high, the cow doesn’t tan at all…The cows have a picnic basket with L (1 ≤ L ≤ 2500) bottles of sunscreen lotion, each bottle i with an SPF rating SPFi (1 ≤ SPFi ≤ 1,000). Lotion bottle i can cover coveri cows with lotion. A cow may lotion from only one bottle.
What is the maximum number of cows that can protect themselves while tanning given the available lotions?
Input
- Line 1: Two space-separated integers: C and L
- Lines 2…C+1: Line i describes cow i’s lotion requires with two integers: minSPFi and maxSPFi
- Lines C+2…C+L+1: Line i+C+1 describes a sunscreen lotion bottle i with space-separated integers: SPFi and coveri
Output
A single line with an integer that is the maximum number of cows that
can be protected while tanning
Sample Input
3 2
3 10
2 5
1 5
6 2
4 1
Sample Output
2
相關文章
- 8.13(優先佇列貪心維護+打表找規律+對頂堆優先佇列+DFS減枝+貪心dp)佇列
- CodeForces - 960B:Minimize the error(優先佇列+貪心)Error佇列
- [USACO 2009 Feb Gold] Fair Shuttle (貪心+優先佇列)GoAI佇列
- PHP優先佇列PHP佇列
- 優先佇列的學習記錄--例題:Expedition(POJ2431)佇列
- HDU - 6003 Problem Buyer題解(貪心選擇演算法,鴿巢原理,優先佇列維護)演算法佇列
- 【貪心】POJ 3617:Best Cow Line
- STL 優先佇列 用法佇列
- 淺談優先佇列佇列
- 堆與優先佇列佇列
- 優先佇列和堆排序佇列排序
- 【ybtoj】【貪心】【堆】【例題1】奶牛曬衣服
- 01揹包優先佇列優化佇列優化
- POJ2253 Frogger【並查集+貪心】並查集
- 佇列 優先順序佇列 python 程式碼實現佇列Python
- 棧,佇列,優先順序佇列簡單介面使用佇列
- NO GAME NO LIFE(優先佇列/最小堆)GAM佇列
- 優先佇列的比較器佇列
- 封裝優先順序佇列封裝佇列
- POJ1797 Heavy Transportation【並查集+貪心】並查集
- 三、資料結構演算法-棧、佇列、優先佇列、雙端佇列資料結構演算法佇列
- STL優先佇列最小堆最大堆佇列
- leetcode621——優先佇列的思路LeetCode佇列
- 演算法面試(三) 優先佇列演算法面試佇列
- 二叉堆實現優先佇列佇列
- 手擼優先佇列——二叉堆佇列
- C++ STL 優先佇列 (priority_queue)C++佇列
- .NET 6 優先佇列 PriorityQueue 實現分析佇列
- Java優先順序佇列DelayedWorkQueue原理分析Java佇列
- 堆、堆排序和優先佇列的那些事排序佇列
- 最詳細版圖解優先佇列(堆)圖解佇列
- 【堆】【優先佇列】[NOIP2004]合併果子佇列
- Facebook的分散式優先順序佇列FOQS分散式佇列
- 【Dijkstra演算法】未優化版+優先佇列優化版演算法優化佇列
- POJ 2376 Cleaning Shifts(區間貪心之區間覆蓋)
- codeforces round 974(div.3)E(優先佇列實現dijstra演算法,devc++的優先佇列用greater報錯)佇列JS演算法devC++
- CSP之公共鑰匙盒(模擬、排序、優先佇列)排序佇列
- Python3 執行緒優先順序佇列( Queue)Python執行緒佇列