题意: 对于一个给定长度为N的字符串,求它的第K小子串是什么。N<=5000000,K<=1000000000。 题解: 对于本题,首先我们要做的事情是先建立后缀自动机。 如果T=0,那么每一个位置的出现次数直接设为1,T=1否则就是正常的right集合大小。 那么我们可以再记一个sum[i],表示 ...
分类:
其他好文 时间:
2020-02-13 13:13:09
阅读次数:
67
这道题用树状数组做比较好,虽然树状数组能做的线段树也可以做到,但是树状数组更简洁方便,易操作 原理便是第x个数的二进制数最后一个“1”,决定tree的结点的长度 比如: sum[3]=tree[3]+tree[2]; sum[4]=tree[4]; sum[5]=tree[5]+tree[4]; 分 ...
分类:
其他好文 时间:
2020-02-12 13:15:00
阅读次数:
42
参考 https://www.cnblogs.com/null00/archive/2012/04/22/2464876.html #include <stdio.h> #include <algorithm> #define LEN 10000 using namespace std; struc ...
分类:
其他好文 时间:
2020-02-11 20:48:58
阅读次数:
75
这是一道简单应用线段树的题 代码也是书上的,敲一边熟悉一下 #include <iostream>#include <cstdio>using namespace std;const int MAX=1e5+10;long long sum[MAX<<2],add[MAX<<2]; void up_ ...
分类:
其他好文 时间:
2020-02-11 19:07:08
阅读次数:
53
话说主席树还没写就先写这一篇了$qwq$ 回顾一下主席树的实现过程:类似查分思想,将线段树的每次修改看做函数式以支持可持久化。因为这样的线段树是可减的。 那么我们维护信息的时候,就要维护每一次新形成的信息。但是我们可以根据前一个信息的基础上进行改动,而不必要去再建一棵树。 所以总而言之,是前缀和的思 ...
分类:
编程语言 时间:
2020-02-11 11:20:46
阅读次数:
96
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int N=1e5+10; struct node{ ...
分类:
其他好文 时间:
2020-02-11 09:27:57
阅读次数:
52
//线段树区间覆盖 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int N=100010; int flag; struct node{ in ...
分类:
其他好文 时间:
2020-02-11 09:25:59
阅读次数:
54
//add,懒标记,给以当前节点为根的子树中的每一个点加上add(不包含根节点) // #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef ...
分类:
其他好文 时间:
2020-02-11 09:22:13
阅读次数:
70
第一行输入n,m ,n代表有n个房间,编号为1 n,开始都为空房,m表示以下有m行操作,以下 每行先输入一个数 i ,表示一种操作: 若i为1,表示查询房间,再输入一个数x,表示在1 n 房间中找到长度为x的连续空房,输出连续x个房间中左端的房间号,尽量让这个房间号最小,若找不到长度为x的连续空房, ...
分类:
其他好文 时间:
2020-02-10 10:16:48
阅读次数:
66
第一次写这个题是好长时间以前了,然后没调出来. 本来以为是思路错了,结果今天看题解发现思路没错,但是好多代码细节需要注意. code: #include <cstdio> #include <vector> #include <map> #include <cstring> #include <al ...
分类:
其他好文 时间:
2020-02-09 16:50:44
阅读次数:
83