博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spoj 694 Distinct Substrings
阅读量:7219 次
发布时间:2019-06-29

本文共 780 字,大约阅读时间需要 2 分钟。

n-sa[k]+1-height[k] 累加

1 #include
2 #include
3 #include
4 using namespace std; 5 const int maxn=1000+10; 6 char s[maxn]; 7 int sa[maxn],t[maxn],t2[maxn],c[maxn]; 8 int rank[maxn],height[maxn]; 9 void build_sa(int n,int m)10 {11 int i,*x=t,*y=t2;12 13 for(i=0;i
=0;i--) sa[--c[x[i]]]=i;17 for(int k=1;k<=n;k<<=1)18 {19 int p=0;20 for(i=n-k;i
=k) y[p++]=sa[i]-k;22 23 for(i=0;i
=0;i--) sa[--c[x[y[i]]]]=y[i];27 28 swap(x,y);29 p=1;x[sa[0]]=0;30 for(i=1;i
=n) break;33 m=p;34 }35 }36 void getHeight(int n)37 {38 int i,k=0;39 for(i=1;i<=n;i++) rank[sa[i]]=i;40 for(i=0;i

转载于:https://www.cnblogs.com/sooflow/p/3382680.html

你可能感兴趣的文章
Eclipse打包插件Fat Jar 解压打包
查看>>
Apache Shiro 使用手册
查看>>
CentOS mini 6.5 安装DB2 Express-C 问题处理记录
查看>>
DirectByteBuffer
查看>>
Docker Compose文件详解 V2
查看>>
Memcached的原理与应用(未完)
查看>>
基于 Confluence 6 数据中心的 SAML 单点登录设置你的身份提供者
查看>>
mysql总结
查看>>
Navicat for MySQL版本更新至v11.2.12,修复多项问题|附下载
查看>>
整理 JAVA中的IO流 (字符流和字节流两个大类)
查看>>
uefi与win8 (根据网络资料整理)
查看>>
Eclipse优化
查看>>
Log4j tutorial with Tomcat examples
查看>>
Kong 网关
查看>>
三层结构视频中的DBHelper.cs
查看>>
[转载] 信息系统项目管理师视频教程——18 项目沟通管理
查看>>
在Windows下建立QT开发环境
查看>>
Jedis、JedisPool、ShardedJedis和ShardedJedisPool,java对redis的基本操作
查看>>
[转载] 致命伴侣
查看>>
HTML5 localStorage本地存储实际应用举例
查看>>