Description
Here is a circle sequence S of length n, and you can choose a position and remove the number on it.
After that,you will get a integer. More formally,you choose a number x( 1<=x<=n ),then...
分类:
编程语言 时间:
2015-04-20 15:01:12
阅读次数:
209
这道题注意要是不重叠的,一开始这里WA了一次
其他的思路应该挺简单的
#include
#include
#include
using namespace std;
#define N 100100
int r[N];
char s[11][10005];
int wa[N],wb[N],wv[N],ws[N];
int sa[N],rank[N],height[N];
int m[N];...
分类:
其他好文 时间:
2015-04-19 11:38:23
阅读次数:
165
这道题搞了好久,刚开始数组开小了RE,然后是用了set就TLE,最后用数组替换set就变成了WA,最后终于发现了问题,原来if语句和else语句之间的逻辑没搞清楚
A掉之后感觉眼泪都要掉下来了
#include
#include
#include
#include
#include
using namespace std;
#define N 201005
char s[101][2001]...
分类:
其他好文 时间:
2015-04-18 23:48:45
阅读次数:
229
一道后缀数组搞了好几天了,不是TLE就是RE,不是RE就是WA,也是醉了
找点水题来缓解一下郁闷的心情
#include
#include
#include
using namespace std;
int a[105][105],dp[105][105];
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#e...
分类:
其他好文 时间:
2015-04-18 22:03:14
阅读次数:
120
Front compression
Time Limit: 5000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)
Total Submission(s): 1490 Accepted Submission(s): 553Problem Description
Front compression...
分类:
编程语言 时间:
2015-04-18 14:37:41
阅读次数:
182
题意:
给你N个字符串, N(1
问不打乱字符串顺序,从中取若干个字符串,使得前一个串是后一个串的子串,求满足前面调条件的字符串值得和最大,求这个值。
思路:
其实就是一个很明显的dp。
dp[i]代表以第i个字符串结尾的最大权值。
但是就是子串这个问题怎么处理。
由于这题数据比较水可以用后缀数组处理这个问题。
将所有字符串拼接,做sa。
每次在height数组里往上和往下寻找...
分类:
编程语言 时间:
2015-04-17 13:51:50
阅读次数:
174
单调栈的思想很巧妙,若进入的元素比栈顶小,则栈顶出栈,把相应信息更新一下,直到要进入的元素比栈顶元素大
//注意这道题和Facer’s string这道题的区别
//该题求的是sa[i]-sa[j]的lcp,需要用到的是height[i+1]-height[j]
//而 Facer’s string这道题用到的是height[i]-height[j]的值,涉及到的是sa[i-1]-sa[j]
...
分类:
其他好文 时间:
2015-04-16 19:57:25
阅读次数:
136
刚开始提交的时候,惊讶地发现竟然超时了
检查了N遍终于发现把strlen写在了for循环里,这样算算时间复杂度就n^2了
解题思路:
把B串在A串出现的位置找出来
然后单独对A串计算一下height数组,然后枚举每个位置,求可以生成的子串,再减height就可以了
#include
#include
#include
using namespace std;
#define N 100...
分类:
其他好文 时间:
2015-04-16 15:48:14
阅读次数:
237
刚开始求height数组的地方写错了,看来还是理解不够透彻啊
所有的子串减去重复的子串
//先在草稿纸上把思想想清楚再动手,不要只是有个大概的思想,不然容易出错
#include
#include
#include
using namespace std;
#define N 10005
int n;
char s[N];
int r[N],sa[N],height[N],rank[N],...
分类:
其他好文 时间:
2015-04-15 14:56:59
阅读次数:
202