???题目2 : Reverse Suffix Array
来源:互联网 发布:wpf 管理系统源码下载 编辑:程序博客网 时间:2024/05/21 20:27
题目2 : Reverse Suffix Array
- 样例输入
154 3 2 5 1
- 样例输出
98280
描述
There is a strong data structure called "Suffix Array" which can effectively solve string problems.
Let S=s1s2...sn be a string and let S[i,j] denote the substring of S ranging from i to j. The suffix array A of S is now defined to be an array of integers providing the starting positions of suffixes of S in lexicographical order. This means, an entry A[i] is the starting position of the i-th smallest suffix in S and thus for all 1 < i ≤ n: S[A[i-1], n] < S[A[i], n].
For example: the suffix array of “banana” is [6, 4, 2, 1, 5, 3].
Here comes another problem called "Reverse Suffix Array".
Given a suffix array, you need to figure out how many lower case strings are there whose suffix array is the same as the given suffix array.
输入
First line contains a positive number T which means the number of test cases.
For each test cases, first line contains a positive number N, the second line contains N integer(s) which indicates the suffix array A.
1 ≤ T ≤ 10, 1 ≤ N ≤ 100,000
1 ≤ A[i] ≤ N (i = 1...N)
输出
For each test case, output one line contains the answer. If no qualified string exists, output 0.
比赛已经结束,去题库提交。
- ???题目2 : Reverse Suffix Array
- suffix array
- 后缀数组(suffix array)模板(2)
- [hiho1579] Reverse Suffix Array [ACM-ICPC国际大学生程序设计竞赛北京赛区(2017)网络赛 B]
- 后缀数组(Suffix Array)
- HDU 1403 Suffix Array
- 后缀数组suffix array
- Suffix Array 后缀数组
- suffix array written by myself
- Brief Introduction to Suffix Array
- Linear Work Suffix Array Construction
- 后缀数组(Suffix Array)
- Origin Suffix Array && Chairman Tree
- BZOJ4319: cerc2008 Suffix reconstruction Suffix Array 的理解
- Array.reverse( )
- Array Reverse
- 关于Manber-Mayer suffix array 构造算法
- 【SPOJ-SARRAY】Suffix Array【后缀数组】
- ???题目1 : Visiting Peking University
- UVALive7141-BombX
- OptionDemo
- 数据结构顺序表
- 文章标题
- ???题目2 : Reverse Suffix Array
- 详谈typedef的用法
- 一系列比较基础的 自定义view教程
- 智能合约被认为是开发数字货币技术的又一个热门技术
- Maven中的dependency的scope作用域详解
- 基于Flume+Log4j+Kafka的日志采集架构方案
- 请定义一个交通工具(Vehicle)的类,其中有: 属性:速度(speed),体积(size)等 方法:移动(move()),设置速度(setSpeed(int speed)),设置体积(set
- js中的window.onload与jQuery中的$(document).ready()的对比
- 排序算法(快排,希尔排序)