贪心 CF 332 C 好题 赞】的更多相关文章

题目链接: http://codeforces.com/problemset/problem/332/C 题目意思: 有n个命令,要通过p个,某主席要在通过的p个中选择k个接受. 每个任务有两个值ai,bi, ai表示如果该主席接受该命令,她的头发变灰的数量,bi表示如果该主席不接受该命令时,议员不高兴值. 对于通过的p个命令,该主席要使议员的不高兴值和最小,在相同的情况下,要使自己的头发变灰的数量尽可能的少. 让你求出通过哪p个命令,使得该主席的头发变灰的数量最多,在相同的情况下,输出使议员不…
今年暑假不AC Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 55813    Accepted Submission(s): 30009 Problem Description “今年暑假不AC?” “是的.” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多AC…
cf-Education 62-C 题目 C. Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a playlist consisting of nn songs. The ii-th song is characterized by two numbers titi and bibi -…
C. Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output ->  Link  <- 题目就不贴出来了,链接在上面: 题意:给定n,k,然后是一个长度为n的只含字母a.b的字符串,问至多改变k次使得一个子串字母都相同且长度最大,如所给样例: input 10 1 bbabbabbba output…
这题很简单,把目标位置排序,把目标位置在当前位置前面的往前交换,每次都是贪心选择第一个满足这样要求的数字. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> using namespace std; const int MAX=2005; int p1[MAX],p2[MAX],mp[MAX]; int p…
[44]Wildcard Matching [45]Jump Game II (2018年11月28日,算法群衍生题) 题目背景和 55 一样的,问我能到达最后一个index的话,最少走几步. 题解: [55]Jump Game (2018年11月27日,算法群) 给了一个数组nums,nums[i] = k 代表站在第 i 个位置的情况下, 我最多能往前走 k 个单位.问我能不能到达最后一个 index. 题解:虽然是贪心分类,我还是用dp解了.dp[i] 代表我能不能到达第 i 个位置. c…
A. Jumping Ball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. T…
Devu and his Brother time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given…
题目链接 代码借鉴此博:http://www.cnblogs.com/vongang/archive/2011/08/19/2146070.html 其中关于max{c[fa]/t[fa]}贪心原则,此博有很好的解释:http://www.cnblogs.com/rainydays/p/3271277.html 在此引用其中几段话: 试想,如果没有父节点排在节点之前的限制,那么这个题目非常简单,只需要将结点按照权值从大到小排列即可.加上了这个限制之后,如果权值最大的那个节点一旦满足了条件(父节点…
6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子,一直坚持刷题,这一个学期刷了200道吧,感觉还是小有收获.特别是Ural和Codeforces上的题,质量很高. 然后4月的校赛,5月的省赛,发挥的也一般,不过也没有太失常. 希望暑假的选拔赛能碰到有趣的队友 蛤蛤. 这两天各种考试,实在是太忙,看了一下edu24的题目,不是很容易,做了一道水题,以…