HDU #5507 GT and Strings】的更多相关文章

这是AC自动机系列的第一篇 传送门 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)0 大意 给出N个仅由小写字母组成的字符串S[1]...S[N],它们的总长度为L.有Q组询问,询问分两类: 1.S[x]是否是S[y]的子序列: 2.S[x]是否是S[y]的子串. 数据范围: N,L,Q<=100000,有60%的数据满足 L<=100, Q<=1000 Solut…
题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5229 bc:http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=582&pid=1002 题解: 设字符串a,b; 结论:先手胜的充分必要条件是|a|+|b|为奇数或a==b. 证明: 数学归纳法: |a|+|b|=0:时,先手败,结论成立 假设|a|+|b|<p时结论成立,现在分类讨论|a|+|b|的…
题目链接:https://vijos.org/p/1049 题目大意:顺次给出m个置换,重复使用这m个置换对初始序列进行操作.问k次置换后的序列.m<=10, k<2^31. 首先将这m个置换"合并"起来(算出这m个置换的乘积),然后接下来我们须要运行这个置换k/m次(取整.若有余数则剩下几步模拟就可以). 注意随意一个置换都能够表示成矩阵的形式.比如.将1 2 3 4置换为3 1 2 4,相当于以下的矩阵乘法: 置换k/m次就相当于在前面乘以k/m个这种矩阵. 我们能够二…
题目链接: HDU - 1501 Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must stay in its original order.For examp…
hdu 6208 The Dominator of Strings[AC自动机] 求一个串包含其他所有串,找出最长串去匹配即可,但是匹配时要对走过的结点标记,不然T死QAQ,,扎心了.. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; inline )+=c-';} ; ;…
The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 2830    Accepted Submission(s): 1010 Problem Description Here you have a set of strings. A dominator is a string of the…
/* HDU 6170 - Two strings [ DP ] | 2017 ZJUT Multi-University Training 9 题意: 定义*可以匹配任意长度,.可以匹配任意字符,问两串是否匹配 分析: dp[i][j] 代表B[i] 到 A[j]全部匹配 然后根据三种匹配类型分类讨论,可以从i推到i+1 复杂度O(n^2) */ #include <bits/stdc++.h> using namespace std; const int N = 2505; int t;…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6170 题意:给了2个字符串,其中第2个字符串包含.和*两种特别字符,问第二个字符串能否和第一个匹配. 解法:dp[i][j]代表在第一个串的i位置,第2个串的j位置是否可以匹配,然后按照'*'这个特殊情况讨论转移即可. #include <bits/stdc++.h> using namespace std; const int maxn = 3005; bool dp[maxn][maxn];…
题目链接 Problem Description Giving two strings and you should judge if they are matched.The first string contains lowercase letters and uppercase letters.The second string contains lowercase letters, uppercase letters, and special symbols: “.” and “*”..…
Two strings Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Giving two strings and you should judge if they are matched.The first string contains lowercase letters and uppercase letters.The seco…