CF Vitaly and Strings】的更多相关文章

Vitaly and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his…
A. Vitaly and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does…
A. Vitaly and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does…
Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time. During the last lesson the teacher has provided two strings s and t to Vitaly. T…
Set of Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a string q. A sequence of k strings s1, s2, ..., sk is called beautiful, if the concatenation of these strings i…
https://cn.vjudge.net/problem/CodeForces-543C 题目 You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some lett…
题意:给定两个相同长度的字符串,让你找出一个字符串,字典序在两都之间. 析:这个题当时WA了好多次,后来才发现是这么水,我们只要把 s 串加上,然后和算数一样,该进位进位,然后再和 t 比较就行. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <set> #include <cstring> #in…
这里给出来一个后缀自动机的题解. 考虑对 $s$ 的正串和反串分别建后缀自动机. 对于正串的每个节点维护 $endpos$ 的最小值. 对于反串的每个节点维护 $endpos$ 的最大值. 这两个东西通过一个简单的基数排序就可以实现. 将 $p$ 的正串在正串的 SAM 上去匹配,一直匹配到匹配不了为止,并记录 $p[i]$ 在正串中自动机节点上 $endpos$ 的最小值 $a[i]$. 对 $p$ 的反串也进行相同的处理,记录 $endpos$ 的最大值 $b[i]$. 正串中的 $endp…
传送门 解题思路 感觉这种题都是套路之类的??首先把三个串并成一个,中间插入一些奇怪的字符,然后跑遍\(SA\).考虑按照\(height\)分组计算,就是每个\(height\)只在最高位计算一次,然后求个后缀和,这个可以并查集来实现.具体就是记一个\(sum[i][3]\)表示第\(i\)个联通块中\(0,1,2\)的个数,\(0,1,2\)就是出现在三个串的哪一个,然后合并时需要容斥一下. 代码 #include<iostream> #include<cstdio> #inc…
因为要删去1个串(读错题),所以就直接二分搞就好了. 需要预处理出2个分别从头到尾,或从尾到头需要多长a串的数组,然后二分删去多长就好了. #include<bits/stdc++.h> #define LL long long #define N 100005 #define lowbit(x) x&(-x) using namespace std; inline int ra() { ,f=; char ch=getchar(); ; ch=getchar();} +ch-'; c…