• 「BZOJ2342」[SHOI2011] 双倍回文

    「BZOJ2342」[SHOI2011] 双倍回文

    Description Input输入分为两行,第一行为一个整数,表示字符串的长度,第二行有个连续的小写的英文字符,表示字符串的内容。Output输出文件只有一行,即:输入数据中字符串的最长双倍回文子串的长度,如果双倍回文子串不存在,则输出0。SampleInput16ggabaabaabaaballSampleOutput12HINTN<=500000题解p[i]表示i和i+1为中心的最长回文子串长度/2(str[i-k]=str[i+1+k])。。。用manacherOn计算p数组题目要求计...

    02014年12月3日6,437manacher
  • 「vijos1382」寻找主人

    「vijos1382」寻找主人

    Description给定两个项链的表示,判断他们是否可能是一条项链。Input输入文件只有两行,每行一个由0至9组成的字符串,描述一个项链的表示(保证项链的长度是相等的)。Output如果两条项链不可能同构,那么输出’No’,否则的话,第一行输出一个’Yes’,第二行输出该项链的字典序最小的表示。设L=项链长度,对于50%的数据L<=100000;对于100%的数据L<=1000000。题解http://wenku.baidu.com/link?url=Jtn398dsc9nSs...

    02014年12月3日3,124字符串,其它
  • 「CFgym100514I」Peace of AmericanPie

    「CFgym100514I」Peace of AmericanPie

    Youaregivenanencryptedstring,encryptedusingacertainalgorithm.Decryptit!InputThefirstandonlylineofinputcontainsastrings,eachcharacterofsiseither0or1.(8 ≤ |s| ≤ 8 × 104)OutputPrinttheoriginalstring.Sampletest(s)input[crayon-66214df050cea417055719/]output[crayon-66214df050cf2297860445/]input[crayon-66214df050cf5008566911/]output[crayon-66214df050cf8188793119/]input[crayon-66214df050cf...

    02014年11月2日2,768密码学
  • 「CFgym100514R」6227020800

    「CFgym100514R」6227020800

    Youaregivenanencryptedstring,encryptedusingacertainalgorithm.Decryptit!InputThefirstandsinglelineofinputcontainsastrings,whicheachofit'scharactersisalowercaseEnglishletter.(1 ≤ |s| ≤ 105)OutputPrinttheoriginalstring.Sampletest(s)input[crayon-66214df051144886115070/]output[crayon-66214df051166838852554/]input[crayon-66214df05116c884891066/]output[crayon-66214df051171297875561/]input[c...

    02014年11月2日2,550密码学
  • 「BZOJ2145」悄悄话

    「BZOJ2145」悄悄话

    试题来源  2011中国国家集训队命题答辩问题描述  在这个有话不直说的年代,密码学越来越被广泛接受。我们引用经典的“凯撒密码”。在英文中,凯撒加密只对26个字母生效(分大小写)我们按照a到z来排字母。凯撒加密的原理就是把原文的每一个字母都按顺序往后移K位。这个K将被作为密钥。(’a’往后移变成’b’,’z’往后移会变成’a’)(0≤K≤25)现在给出一系列用凯撒加密的英文句子,请你编写程序逐句翻译。也就是说,请...

    92014年10月23日5,075密码学
  • 「CF471D」MUH and Cube Walls

    「CF471D」MUH and Cube Walls

    PolarbearsMenshykovandUsladafromthezooofSt.PetersburgandelephantHoracefromthezooofKievgotholdoflotsofwoodencubessomewhere.Theystartedmakingcubetowersbyplacingthecubesoneontopoftheother.Theydefinedmultipletowersstandinginalineasawall.Awallcanconsistoftowersofdifferentheights.Horacewasthefirsttofinishmakinghiswall.Hecalledhiswallanelephant.Thewallconsistsofwtowers.Thebearsalsofinishedm...

    02014年9月27日3,748KMP
  • 「BZOJ2555」SubString

    「BZOJ2555」SubString

    Description懒得写背景了,给你一个字符串init,要求你支持两个操作(1):在当前字符串的后面插入一个字符串(2):询问字符串s在当前字符串中出现了几次?(作为连续子串)你必须在线支持这些操作。Input    第一行一个数Q表示操作个数第二行一个字符串表示初始字符串init接下来Q行,每行2个字符串Type,StrType是ADD的话表示在后面插入字符串。Type是QUERY的话表示询问某字符串在当前字符串中出现了几次。为了体现在...

    02014年9月25日8,575后缀自动机,link cut tree
  • 「SPOJ7258」Lexicographical Substring Search

    「SPOJ7258」Lexicographical Substring Search

    LittleDaniellovestoplaywithstrings!Healwaysfindsdifferentwaystohavefunwithstrings!Knowingthat,hisfriendKinandecidedtotesthisskillssohegavehimastringSandaskedhimQquestionsoftheform:IfalldistinctsubstringsofstringSweresortedlexicographically,whichonewillbetheK-thsmallest?AfterknowingthehugenumberofquestionsKinanwillask,Danielfiguredoutthathecan'tdothisalone.Daniel,ofcourse,knowsyourexc...

    02014年9月23日4,538后缀自动机
  • 「SPOJ1812」Longest Common Substring II

    「SPOJ1812」Longest Common Substring II

    Astringisfinitesequenceofcharactersoveranon-emptyfinitesetΣ.Inthisproblem,Σisthesetoflowercaseletters.Substring,alsocalledfactor,isaconsecutivesequenceofcharactersoccurrencesatleastonceinastring.Nowyourtaskisabitharder,forsomegivenstrings,findthelengthofthelongestcommonsubstringofthem.Herecommonsubstringmeansasubstringoftwoormorestrings.InputTheinputcontainsatmost10lines,eachlineconsistso...

    02014年9月22日4,089后缀自动机
  • 「SPOJ8222」Substrings

    「SPOJ8222」Substrings

    YouaregivenastringSwhichconsistsof250000lowercaselatinlettersatmost.WedefineF(x)asthemaximalnumberoftimesthatsomestringwithlengthxappearsinS.Forexampleforstring'ababa'F(3)willbe2becausethereisastring'aba'thatoccurstwice.YourtaskistooutputF(i)foreveryisothat1<=i<=|S|.InputStringSconsistsofatmost250000lowercaselatinletters.OutputOutput|S|lines.Onthei-thlineoutputF(i).Example...

    72014年9月17日6,141后缀自动机
  • 「POJ2774」Long Long Message

    「POJ2774」Long Long Message

    DescriptionThelittlecatismajoringinphysicsinthecapitalofByterland.Apieceofsadnewscomestohimthesedays:hismotherisgettingill.Beingworriedaboutspendingsomuchonrailwaytickets(Byterlandissuchabigcountry,andhehastospend16shoursontraintohishometown),hedecidedonlytosendSMSwithhismother.Thelittlecatlivesinanunrichfamily,sohefrequentlycomestothemobileservicecenter,tocheckhowmuchmoneyhehasspentonS...

    02014年9月15日4,997后缀数组
  • 「BZOJ2251」[2010BJ Wc] 外星联络

    「BZOJ2251」[2010BJ Wc] 外星联络

    Description小P在看过电影《超时空接触》(Contact)之后被深深的打动,决心致力于寻找外星人的事业。于是,他每天晚上都爬在屋顶上试图用自己的收音机收听外星人发来的信息。虽然他收听到的仅仅是一些噪声,但是他还是按照这些噪声的高低电平将接收到的信号改写为由0和1构成的串,并坚信外星人的信息就隐藏在其中。他认为,外星人发来的信息一定会在他接受到的01串中重复出现,所以他希望找到他接受到的01串中所有重复出现次数大...

    32014年9月4日4,683后缀数组