有2e5个人,把他们分组,每个人有一个数字 E i E_i Ei?, E i E_i Ei?表示第i个人推荐 _heyuhhh_的B站讲题视频 : https://www.bilibili.com/video/BV1Ai4y147Do?p=2
所在的组至少有 E i E_i Ei?个人,不必每个人都加入组里面,求最多能分多少组
【Codeforces Round #643 (Div. 2) B. Young Explorers】贪心的分组:
从小到大加入组,尝试把第 i i i个人加入组,如果组内人数 c n t + 1 > = E i cnt+1>=E_i cnt+1>=Ei?则上一个组就凑好了,尝试凑下一组
//#define debug
#ifdef debug
#include
#include "/home/majiao/mb.h"
#endif#include
#include
#include
#include
#include
推荐阅读
- 题库-CF|【Codeforces Round 263 (Div 2)C】【贪心 哈弗曼思维】Appleman and Toastman 每个非1size子树延展为2子树的最大权
- Codeforces|Codeforces Round #643 (Div. 2) B.Young Explorers
- ZOJ-3447---Doraemon's Number Game (贪心+大数)
- CodeForces 567A Lineland Mail 贪心
- codeforces|Codeforces Round #643 (Div. 2) D. Game With Array (思维,贪心)
- Codeforces Round #643 (Div. 2) B. Young Explorers 题解(贪心)
- CodeForces - 1060D E - Social Circles
- Codeforces Round #503 (by SIS, Div. 2) C. Elections(贪心)
- 贪心|001:特殊密码锁(贪心)
- 贪心|Codeforces D. Solve The Maze (bfs & 贪心) (Round #648 Div.2)