Bazinga HDU 5510 Bazinga(双指针)】的更多相关文章

Bazinga HDU 5510 Bazinga(双指针) 题链 解法:对于串i来说,如果串i是不符合的,那么代表串i之前的字符串都是i的子串,那么我们求一个新的i(定义为ti),如果i是ti 的子串,那么串i之前的字符串都没必要再匹配了,如果不是,ti就是符合要求的答案之一 #include <cstdio> #include <iostream> #include <cstring> using namespace std; const int N=2005; ch…
Bazinga Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2287    Accepted Submission(s): 713 Problem Description Ladies and gentlemen, please sit up straight.Don't tilt your head. I'm serious.For…
Bazinga Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5510 Description Ladies and gentlemen, please sit up straight. Don't tilt your head. I'm serious.For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you…
http://acm.hdu.edu.cn/showproblem.php?pid=5510 Problem Description: Ladies and gentlemen, please sit up straight.Don't tilt your head. I'm serious.For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you should find the largest i (1≤i≤n) such that t…
Bazinga Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 214    Accepted Submission(s): 89 Problem Description Ladies and gentlemen, please sit up straight.Don't tilt your head. I'm serious.For n…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5510 题意:至多50组数据,每组数据至多500个字符串,每个字符串的长度最长为2000.问最大的下标(从1开始)j,使得存在i < j使得s[i]不是s[j]的子串: 思路:KMP很容易想到,因为Trie是处理前缀串的,不能处理子串.在KMP中,还要优化下,就是父串可以代表子串,并且直接递推处理(用尺取法,每次处理没有父串的串)即可: #include<bits/stdc++.h> usin…
2015沈阳区域赛现场赛第2题 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5510 题意:给定一个由字符串组成的序列,一共n个元素,每个元素是一个不超过2000个字符的字符串.求"存在秩小于 i 且不是 i 的子串"的最大的 i (1<= i <= n). 数据范围:n [1, 500],T组输入,T [1, 50] 思路:从1到n-1枚举每个字符串str[i],判断是否有 j < i 使得str[j]不是str[i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5510 思路: 一开始直接用KMP莽了发,超时了,后面发现如果前面的字符串被后面的字符串包含,那么我们就不需要用前面的字符串去比较了,把他标记掉就好了. 实现代码: #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using namespace std; ][];…
http://acm.hdu.edu.cn/showproblem.php?pid=5510 想了很久队友叫我用ufs + kmp暴力过去了. fa[x] = y表示x是y的子串,所以只有fa[x] == x才需要kmp一次. 那么这样的话,如果全部都不互为子串的话,复杂度还是爆咋的. #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <…
Bazinga Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2078    Accepted Submission(s): 642 Problem Description  to n, you should find the largest i (1≤i≤n) such that there exists an integer j (…