自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 收藏
  • 关注

原创 hdu 4416 后缀自动机 问在S中有多少个不同子串满足它不是s1~sn中任意一个字符串的子串

题意:给一个字符串S和一系列字符串s1~sn,问在S中有多少个不同子串满足它不是s1~sn中任意一个字符串的子串后缀自动机 对sa建立串,然后找每个串在母串上每个点的最大匹配长度,然后最后从后往前拓扑更新就好,因为叶子的max是能影响父亲的max,最后统计的时候 看Maxi是否有值,一旦有值,必定是这个点上的合法的值,那么就是统计上 Max[p]-Maxi[p] 而且往父节点更新,否则就是Max[p

2017-10-24 20:45:15 442

原创 后缀自动机求第k大字符串 SPOJ - SUBLEX

Little Daniel loves to play with strings! He always finds different ways to have fun with strings! Knowing that, his friend Kinan decided to test his skills so he gave him a string S and asked him Q qu

2017-10-24 19:46:17 609

原创 SPOJ NSUBSTR 求每个对应的长度能产生的相同子串的最大个数

You are given a string S which consists of 250000 lowercase latin letters at most. We define F(x) as the maximal number of times that some string with length x appears in S. For example for string ‘aba

2017-10-24 19:40:05 389

原创 codeforces 873D merge sort 构造

D. Merge Sort time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Merge sort is a well-known sorting algorithm. The main function that sorts t

2017-10-24 10:16:44 450

原创 最大上升子序列(从前往后) nlogn 和最大上升序列(从后往前)

#includeusing namespace std;const int N = 1e5+10;int arr[N],len1[N],len2[N];int len,ans[N];int tot;int T[N];int ls[N*20],rs[N*20],sum[N*20];int binary_search(int i){ int left,right,mid;

2017-10-21 01:05:27 368

原创 hdu 4436 后缀自动机算和

In this problem, you are given several strings that contain only digits from '0' to '9', inclusive. An example is shown below. 101 123 The set S of strings is consists of the N strings given i

2017-10-20 20:00:02 407

原创 codeforces 846D (二分+二维前缀和)Monitor

Recently Luba bought a monitor. Monitor is a rectangular matrix of size n × m. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken t

2017-10-20 00:31:11 439

原创 hdu 4347 kdtree kdtree+优先队列

The course of Software Design and Development Practice is objectionable. ZLC is facing a serious problem .There are many points in K-dimensional space .Given a point. ZLC need to find out the closest

2017-10-19 23:43:37 330

转载 bzoj 2648 (kdtree模板题)

这天,SJY显得无聊。在家自己玩。在一个棋盘上,有N个黑色棋子。他每次要么放到棋盘上一个黑色棋子,要么放上一个白色棋子,如果是白色棋子,他会找出距离这个白色棋子最近的黑色棋子。此处的距离是 曼哈顿距离 即(|x1-x2|+|y1-y2|) 。现在给出N Input第一行两个数 N M以后M行,每行3个数 t x y如果t=1 那么放下一个黑色棋子如果t=2 那么放下

2017-10-19 14:43:32 600

原创 hdu 6085 (bitset区间取值)

As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: There are nn children and mm kinds of candies. Th

2017-10-19 00:02:19 591

原创 hdu 4622 后缀数组计数问题||后缀自动机

Now you are back,and have a task to do: Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s. And you have some query,each time you

2017-10-18 10:32:08 398

原创 poj 3764 字典树 树上任意两点边权异或最大值

In an edge-weighted tree, the xor-length of a path p is defined as the xor sum of the weights of edges on p:⊕ is the xor operator.We say a path the xor-longest path if it has the largest xor-len

2017-10-16 14:53:09 468

原创 hdu 3518 Boring counting 后缀数组

Problem Description035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,suc

2017-10-11 21:03:42 422

原创 poj 3415 后缀数组+单调栈||后缀自动机

Common Substrings Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11519 Accepted: 3814 DescriptionA substring of a string T is defined as:T(i, k)=TiTi+1…Ti+k-1, 1≤i≤i+k-1≤|T|.

2017-10-10 15:22:58 479

原创 spoj LCS2(多个串的最长公共子序列,后缀自动机)

A string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set of lowercase letters.Substring, also called factor, is a consecutive sequence of characters occurre

2017-10-09 17:33:11 892 1

转载 codeforces 868D 分治哈希

转:http://blog.csdn.net/sinat_35406909/article/details/78162440是否含有所有长度为k的01串,如果是,输出最大的k,否则输出0.这道题和之前的一道树分治题目挺像。 戳这里 首先二分答案k,验证所有长度为k的不同子串是否有2^k个。对当前串进行dfs,不断将当前串分成之前的串。对于当前串,假设两个原串的所有长度为k的串都已经考虑过,那

2017-10-09 14:49:13 469

原创 spoj 1812(两个串的最长公共子串)后缀自动机

A string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set of lowercase letters.Substring, also called factor, is a consecutive sequence of characters occurre

2017-10-05 14:57:00 592

转载 Codeforeces 727 E 字符串双Hash 2017/1/12

题意:n个长度为k的字符串,首尾相接,按顺时针顺序写在一张CD上,每个字符串只写一次总字符串长度小于1e6。保证每个字符串不同。这样CD上就有了一个环形字符串,长度是n*k。又给出g个长度为k的字符串列表(编号从1到g),按照顺时针打印CD上字符串的编号。保证每个字符串不同。保证这g个字符串长度的和小于2*1e6。 下面代码和思路参考了Wannafly每日一题,顺便学会了Hash。记录了模板。

2017-10-04 01:08:26 302

原创 poj 2763(树链剖分)边剖(树状数组版)

After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts connected by bidirecti

2017-10-03 21:02:26 380

原创 后缀自动机 重复旋律 7 求所有不同的子串的值的总和

时间限制:15000ms 单点时限:3000ms 内存限制:512MB 描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一段音乐旋律可以被表示为一段数构成的数列。神奇的是小Hi发现了一部名字叫《十进制进行曲大全》的作品集,顾名思义,这部作品集里有许多作品,但是所有的作品有一个共同特征:只用了十个音符,所有的音符都表示成0-9的数字。现在小Hi想知道这部作品中所有不同的旋律的“和”(也就是把串

2017-10-03 18:52:30 333

原创 后缀自动机 重复旋律 6(长度为K的旋律中出现次数最多的旋律的出现次数)

题目1 : 后缀自动机三·重复旋律6 时间限制:15000ms 单点时限:3000ms 内存限制:512MB 描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为一段数构成的数列。现在小Hi想知道一部作品中所有长度为K的旋律中出现次数最多的旋律的出现次数。但是K不是固定的,小Hi想知道对于所有的K的答案。解题方法提示输入共一行,包含一个由小写字母构成的字符串S。字符串长度不

2017-10-03 14:49:01 573

原创 后缀自动机 重复旋律 5(求所有本质不同的子串)

后缀自动机二 重复旋律五本题要求我们求出一个字符串S中本质不同的子串个数。显然,答案就是所有状态上的子串个数之和,这里说的一个状态上的子串个数,是longest-shortest+1。主要需要学习的是,后缀自动机的O(N)构建方法。需要了解的是,一个状态u的shortest=fail.longest+1。#include <bits/stdc++.h>using namespace std;co

2017-10-03 13:23:10 1402

转载 树链剖分 模板 汇总

记录几个树链剖分的模板题,包括点操作,边操作和带方向的操作。hdu 3966#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>#include <vector>#include <queue>#include <stack>#include <set>#

2017-10-03 12:33:39 279

原创 hdu 5044(树链剖分+区间标记小优化)

You are given a tree (an acyclic undirected connected graph) with N nodes. The tree nodes are numbered from 1 to N There are N - 1 edges numbered from 1 to N - 1. Each node has a value and eac

2017-10-03 00:10:56 260

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除