分类 - 字符串算法

? 解题记录 ? ? 杂OJ ? ? 回文自动机 ?    2018-03-10 09:11:00    610    0    0
【题目描述】对于给定的字符串S,我们想知道它有多少个不同的回文子串。 【输入】一行,一个长度不超过100000的仅小写字母构成的字符串。 【输出】一个整数,代表不同的回文子串个数。 【输入样例】abcd 【输出样例】4 【提示】有20%的数据,输入字符串的长度不超过1000。 本题有后缀数组的O(n log n)算法,但是既然咱们有回文自动机不是板子题就轻松切掉了嘛。于是又水了一题…… #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int
? 原创 ?    2018-01-26 17:50:39    200    0    0
PDF以及配套数据下载地址:难题选讲1-送你一序列字符串-Rockdu.rar 浅谈一类字符串问题 引言:有一类不常规的序列上字符串问题十分的特别。下面我们来看一个例子。 所有公共子序列问题V2 时空限制:1s/256MB 题目描述: 给定长度分别为n, m的只包含小写字母的串A, B。你需要输出A、B所有本质不同的公共(或公共回文)子序列的个数,答案对66662333取模。详见数据范围。(空序列算作回文序列) 输入格式: 一行n, m, k, k作为子问题标识 第二行长度为n的字符串,表示A 另一行长度为m的字符串,表示B
? 解题记录 ? ? HDU ?    2018-01-16 15:21:11    456    0    0
Problem Description CRB has two strings s and t.In each step, CRB can select arbitrary character c of s and insert any character d (d ≠ c) just after it.CRB wants to convert s to t. But is it possible?   Input There are mult
? 解题记录 ? ? AC自动机 ? ? HDU ?    2018-01-16 14:55:53    428    0    0
Problem Description > The Eternal Fleet was built many centuries ago before the time of Valkorion by an unknown race on the planet of Iokath. The fate of the Fleet's builders is unknown but their legacy would live on. Its first known action was in the annihilation of all life in Wild Space. It sp
? 解题记录 ? ? 洛谷 ? ? 后缀自动机 ?    2018-01-16 08:08:27    575    0    0
题目描述给定两个字符串,求出在两个字符串中各取出一个子串使得这两个子串相同的方案数。两个方案不同当且仅当这两个子串中有一个位置不同。 输入输出格式输入格式:   两行,两个字符串s1,s2,长度分别为n1,n2。1 <=n1, n2<= 200000,字符串中只有小写字母   输出格式:   输出一个整数表示答案   输入输出样例输入样例#1: 复制aabb bbaa 输出样例#1: 复制10​​把两个串串起来加”#“建立”广义“后缀自动机。对于一个节点记录两个信息。一个维护在前一个字符串中出现的次数,一个维护在后一个字
? 集训题目 ? ? AC自动机 ? ? 动态规划 ? ? 解题记录 ?    2018-01-15 22:18:59    538    0    0
【题目描述】 给定正整数m以及n个01串s1~sn,你需要求出长度为2m的反对称的包含这n个01串作为子串的01串的个数。对998244353取模。 一个01串s是反对称的当且仅当它对于1<=i<=|s|都满足s[i]≠s[|s|-i+1]。 【输入数据】 第一行两个整数n,m。接下来n行每行一个字符串s1~sn。 【输出数据】 一行一个整数表示答案。 【样例输入】        2 3        011     &nb
? 解题记录 ? ? SPOJ ? ? 后缀数组 ?    2017-12-09 16:09:16    371    0    0
Given a string, we need to find the total number of its distinct substrings. InputT- number of test cases. T<=20; Each test case consists of one string, whose length is <= 1000 OutputFor each test case output one number saying the number of distinct substrings. ExampleSample Input: 2 CCCCC ABA
? 解题记录 ? ? Codeforces ? ? 回文自动机 ?    2017-11-25 12:00:35    453    0    0
DescriptionAfter finishing his homework, our problem setter Federmann decided to kill time by hangingaround online. He found a cool chat room that discusses competitive programming. Federmannhas already joined lot of such chat rooms, but this one is special. Once he entered thechat room, he noticed
? 解题记录 ? ? 杂OJ ? ? 回文自动机 ?    2017-11-25 11:51:21    418    0    0
411. Petya the Hero Time limit per test: 0.25 second(s) Memory limit: 65536 kilobytes input: standard output: standard Petya has come back from the Berland-Birland War, and now he is fond of gathering his friends and narrating his heroic deeds. You have probably heard the story telling that Petya,
? 解题记录 ? ? BZOJ ? ? 回文自动机 ?    2017-11-23 11:13:58    610    0    0
Description考虑一个只包含小写拉丁字母的字符串s。我们定义s的一个子串t的“出 现值”为t在s中的出现次数乘以t的长度。请你求出s的所有回文子串中的最 大出现值。  Input输入只有一行,为一个只包含小写字母(a -z)的非空字符串s。  Output输出一个整数,为逝查回文子串的最大出现值。  Sample Input【样例输入l】 abacaba 【样例输入2] www Sample Output【样例输出l】 7 【样例输出2] 4 HINT  一个串是回文的,当且仅当它从左到右读和从