题目大意:给一个长度为n的整数序列,定义egg(i,j)表示区间[i,j]中不同的数的个数。q次询问,每次询问x,表示求所有长度为x连续区间的 egg 之和。 题目分析:定义dp(len)表示所有长度为len的连续区间的egg之和。 则,dp(len)=dp(len-1)-egg(最后一个长度为le ...
分类:
其他好文 时间:
2016-07-31 19:00:25
阅读次数:
165
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati ...
分类:
其他好文 时间:
2016-07-31 00:01:28
阅读次数:
335
后缀数组。按照排序完的后缀一个一个统计。每一个后缀对答案做出的贡献为:n-SA[i]-height[i]。 ...
分类:
其他好文 时间:
2016-07-30 14:59:03
阅读次数:
155
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description You are given string s. Your task is to determine if the given strin ...
分类:
其他好文 时间:
2016-07-30 12:04:28
阅读次数:
210
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati ...
分类:
其他好文 时间:
2016-07-21 23:52:03
阅读次数:
419
http://poj.org/problem?id=1226 题意:给定n个串。求一个最长的串,使得这个串或者其反串在每个串中都出现过? 思路:先在大串里面加入正反串,然后二分,判定即可。 ...
分类:
其他好文 时间:
2016-07-03 23:23:56
阅读次数:
128
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati ...
分类:
其他好文 时间:
2016-06-25 17:44:12
阅读次数:
164
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati ...
分类:
其他好文 时间:
2016-06-04 23:47:08
阅读次数:
600
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 #define maxn 500005 7 #define maxm 250005 8 ...
分类:
其他好文 时间:
2016-06-01 15:41:05
阅读次数:
236
计算所都不相同子串的个数,做法是所有子串的个数减去sigma(height[]).其中height数组的和便是所有相同子串的个数。 注意 N×(N+1)/2会爆int!但是最终答案在int内。所以使用sigma(n-sa[i]+1-height[i])的做法不会wa ...
分类:
编程语言 时间:
2016-05-19 23:18:14
阅读次数:
232