题解 [CF332C] Students' Revenge】的更多相关文章

题面 解析 辣鸡题面毁我青春 因为翻译的题面中写了一句\(剩下的n−k个不会完成\). 所以就以为剩下的\(n-k\)个都会算上不满意值. (然而事实是只有\(p-k\)个...) 首先根据主席的规则,我们可以先钦定\(p-k\)个绝对不会被选的任务, 把\(b\)从大到小,再把\(a\)从小到大取最后面就行了. (应该很容易理解吧...) 然后再把剩下的按\(a\)从大到小, 再把\(b\)从大到小排序,取前\(k\)个就是白头发最多的情况了. 这里把\(b\)从大到小是因为剩下的\(p-k\…
Codeforces 332 C 我爱对拍,对拍使我快乐... 题意:有\(n\)个议题,学生们会让议会同意\(p\)个,其中主席会执行\(k\)个, 每一个议题执行后主席会掉\(a_i\)的头发,不执行后议会会增加\(b_i\)的不开心值, 然后主席想让议会的不开心值最小,如果有多重方案就选自己头发掉的最少的: 而学生们想让主席的头发掉的最多,如果有多种方案让议会的不开心值最大. 问让议会同意哪\(p\)个会达到最好的效果. 思路1: 这是我的不对的思路. (虽然没提交 我们首先将所有的数按照…
题目传送门 题目大意 给出 \(m\) 次操作,分别为以下两种操作: 学习一个单词 给出一个段落,查询里面有多少个学过的单词.注意,如果学习过 \(\text{ab,bc}\) ,当前查询段落为 \(\text{abc}\) ,那么应该算 \(2\) 个单词. \(m\le 10^5\),保证学习的单词长度之和 \(\le 10^5\),给出的段落长度之和 \(\le 5\times 10^6\) . 思路 据说可以直接拿暴力艹过去...(不会吧?阿sir? 可以看出来,如果只有一次查询,那其实…
Lost and AekdyCoin are friends. They always play "number game"(A boring game based on number theory) together. We all know that AekdyCoin is the man called "nuclear weapon of FZU,descendant of Jingrun", because of his talent in the fie…
题意:给你些分数串,给你一个主串,主串每出现一个分数串加一分,要你重新排列主串,最多几分 思路:显然这里开$40^4$去状压内存不够.但是我们自己想想会发现根本不用开那么大,因为很多状态是废状压,不是不存在的,那么可以考虑想办法简化状态. 一个是hash,直接打表所有子情况,用ha[][][][]表示出所有情况,那么直接dp[status][size]去dp. 还有一种用变进制: 假设ACGT的总数分别为num[0],num[1],num[2],num[3] 那么对于ACGT的数量分别为ABCD…
Save the Students Time Limit:134MS     Memory Limit:0KB     64bit IO Format:%lld & %llu   Description Hogwarts is under attack by the Dark Lord, He-Who-Must-Not-Be-Named. To protect the students, Harry Potter must cast protective spells so that those…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5019 Problem Description In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or greatest common measure (gcm), of two or more i…
Revenge of Nim II Problem DescriptionNim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. On each turn, a player must remove at least one object, and may remove any number of objects provided th…
The Revenge of the Princess’ Knight Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is jus…
题目链接:hdu_4787_GRE Words Revenge 题意: 总共有n个操作,2种操作.每行读入一个字符串. 1.如果字符串以+开头,此为单词(即模式串,不考虑重复) 2.如果字符串以?开头,此为文章(即文本串,查询在此之前的单词在文本串中出现的次数) 题解: 强制在线的AC自动机 贴个大牛的详细题解http://blog.csdn.net/no__stop/article/details/16823479 这样的带合并操作的AC自动机用第二种建树的方式比较方便 #include<bi…