A. Salem and Sticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Salem gave you nn sticks with integer positive lengths a1,a2,…,ana1,a2,…,an. For every stick, you can change its length t…
题意 一个长为 \(n\) 的字符串 \(s\),和 \(m\) 个询问.每次询问有 \(4\) 个参数分别为 \(a,b,c,d\). 要你告诉它 \(s[a...b]\) 中的所有子串 和 \(s[c...d]\) 的 最长公共前缀 \((\mathrm{LCP})\) 的最大值. \((1\le n,m\le 10^5, a\le b,c\le d,1\le a,b,c,d\le n)\) 题解 一开始看错了题 以为是 \([a,b]\) 中所有子串 和 \([c,d]\) 中所有子串的…
2251: [2010Beijing Wc]外星联络 Time Limit: 30 Sec  Memory Limit: 256 MBSubmit: 670  Solved: 392[Submit][Status][Discuss] Description 小 P 在看过电影<超时空接触>(Contact)之后被深深的打动,决心致力于寻找外星人的事业.于是,他每天晚上都爬在屋顶上试图用自己的收音机收听外星人发来的信息.虽然他收听到的仅仅是一些噪声,但是他还是按照这些噪声的高低电平将接收到的信号…
2754: [SCOI2012]喵星球上的点名 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1906  Solved: 839[Submit][Status][Discuss] Description a180285幸运地被选做了地球到喵星球的留学生.他发现喵星人在上课前的点名现象非常有趣.   假设课堂上有N个喵星人,每个喵星人的名字由姓和名构成.喵星球上的老师会选择M个串来点名,每次读出一个串的时候,如果这个串是一个喵星人的姓或名的子串,那…
A. Salem and Sticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Salem gave you nn sticks with integer positive lengths a1,a2,…,ana1,a2,…,an. For every stick, you can change its length t…
Brief Description 找到 01 串中所有重复出现次数大于 1 的子串.并按字典序输出他们的出现次数. Algorithm Design 求出后缀数组之后,枚举每一个后缀,对于每个后缀从height[i]+1枚举(因为height[i]之前已经计算过了),然后对于这样的每个前缀看一看上下能够分别延伸到哪里. 我不会分析复杂度,但是这个算法还是能跑得过得. Notice 开始想了一个复杂度低但是错误的算法,然后思路就被局限住了.所以,以后想不到好的算法的时候一定要先想一个最暴力的暴力…
传送门 原本的想法是把所有的串不管是名字还是询问都连起来,记录一下询问串在sa数组中的位置 对于每个询问可以在sa数组中二分出左右边界,第一问用莫队,第二问差分乱搞. 结果发现我差分的思路想错了,先写了一个暴力,二分出左右边界之后直接从l枚举到r,想试试正确性,就交了一遍,结果过了.... 因为是暴力,可以不用二分左右边界,直接向左向右枚举扩展就可以了,st表也不用了,但我懒得改了 #include <cmath> #include <cstdio> #include <cs…
C. Appleman and a Sheet of Paper   Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1 × n. Your task is help Appleman with folding of such a sheet. Actually, you need to perform q queries. Each query will hav…
分析:a^b+2(a&b)=a+b  so->a^(-b)+2(a&(-b))=a-b 然后树状数组分类讨论即可 链接:http://www.ifrog.cc/acm/problem/1023 吐槽:这个题本来是mod(2^40),明显要用快速乘啊,但是用了以后狂T,不用反而过了,不懂出题人 #include <iostream> #include <algorithm> #include <cmath> #include <vector&g…
E. Garlands 题目连接: http://www.codeforces.com/contest/707/problem/E Description Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with gar…