HDU 4787 GRE Revenge】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4787 题目大意: 给你若干个单词,查询一篇文章里出现的单词数.. 就是被我水过去的...暴力重建AC自动机- -然后暴力查找.. #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <map> #include <string&g…
题链: http://acm.hdu.edu.cn/showproblem.php?pid=4787 题解: AC自动机(强制在线构造) 题目大意: 有两种操作, 一种为:+S,表示增加模式串S, 另一种为:?S,表示查询S中有多少子串为已经给出的模式串. (同时由于输入根据上一次的答案加密 ,所以强制在线) (事先提一下,对于多次给出的相同模式串,是要去重的,至于怎么去重,就随便用trie树或者map+string就好了.) 进入正题: 难道真的要让AC自动机变得在线起来么? 其实还是用普通A…
Description Now Coach Pang is preparing for the Graduate Record Examinations as George did in 2011. At each day, Coach Pang can: "+w": learn a word w "?p": read a paragraph p, and count the number of learnt words. Formally speaking, co…
传送阵:http://acm.hdu.edu.cn/showproblem.php?pid=4898 题目大意:一个首尾相连的字符串,将其分为k个子串,使得最大的字串最小 将所有子串排序,输出第k小即可 对于有循环节的串,用抽屉原理解决即可 #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> using namesp…
GRE Words Once More! Time Limit: 5000/5000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 205    Accepted Submission(s): 32 Problem Description Now Matt is preparing for the Graduate Record Examinations as Coach P…
题目链接 problem Recently George is preparing for the Graduate Record Examinations (GRE for short). Obviously the most important thing is reciting the words. Now George is working on a word list containing N words. He has so poor a memory that it is too…
题目链接:HDU-5118 题意:给定一个有向无环图,每条边有一个权值.标定一些特定节点为“特殊节点”.从节点1出发到某“特殊节点”结束的路径,称为一个“GRE单词”.单词由路径上的权值组成.给定一组查询\(k_i\),问由给定的图产生的所有单词,按字典序排序后第\(k_i\)个单词的长度(即由多少条边组成). 思路:首先这道题最吓人之处在于\(k_i<=10^{8}\),单纯的扫一遍所有可能出现的单词会超时.这时我们发现,输出时只要求输出单词长度,而不要求输出单词内容.由于是DAG,每个节点不…
Nim 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 they all come from the same heap. ---Wi…
题意:给定一个环形字符串,让他把它分成k份,使得最大的字典序 最小. 思路:二分答案,首先很明显答案所有可能是 n*n种  排序可以先求出最长公共前缀,这样比较就只需要比较公共前缀的下一位就能比较出两种答案的字典序大小,这里公共前缀我用 (2*n)*(2*n) DP 求出 .(也可用后缀数组).接下来就是判断了: 这里二分出来的答案就是字典序的上界,(对于没一个位置作为起点,长度越长字典序越大)那么对于当前答案每个位置都可以求出一个能向后跳的最大值(根据如果以这个点做一个串的起点那么字典序要小于…
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 just like a boy in love and can’t refus…