TopCoder

User's AC Ratio

100.0% (3/3)

Submission's AC Ratio

100.0% (3/3)

Tags

Description

Given a length $N$ string $S$. Calculate the suffix array of $S$, $a_ i$.

Input Format

$S$

Output Format

$a_ 0$ $a_ 1$ ... $a_ {N-2}$ $a_ {N-1}$

Sample Input 1

abcbcba

Sample Output 1

6 0 5 3 1 4 2

Sample Input 2

mississippi

Sample Output 2

10 7 4 1 0 9 8 6 3 5 2

Sample Input 3

ababacaca

Sample Output 3

8 0 2 6 4 1 3 7 5

Sample Input 4

aaaaa

Sample Output 4

4 3 2 1 0

Hints

  • $1 \leq N \leq 5 \times 10^ {5}$
  • Each character of $S$ is lowercase English letters.

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 2097152 2097152
1 5000 2097152 2097152
2 5000 2097152 2097152
3 5000 2097152 2097152
4 5000 2097152 2097152
5 5000 2097152 2097152
6 5000 2097152 2097152
7 5000 2097152 2097152
8 5000 2097152 2097152
9 5000 2097152 2097152
10 5000 2097152 2097152
11 5000 2097152 2097152
12 5000 2097152 2097152
13 5000 2097152 2097152
14 5000 2097152 2097152
15 5000 2097152 2097152
16 5000 2097152 2097152
17 5000 2097152 2097152
18 5000 2097152 2097152
19 5000 2097152 2097152
20 5000 2097152 2097152
21 5000 2097152 2097152
22 5000 2097152 2097152
23 5000 2097152 2097152
24 5000 2097152 2097152
25 5000 2097152 2097152
26 5000 2097152 2097152
27 5000 2097152 2097152
28 5000 2097152 2097152
29 5000 2097152 2097152
30 5000 2097152 2097152
31 5000 2097152 2097152
32 5000 2097152 2097152
33 5000 2097152 2097152
34 5000 2097152 2097152
35 5000 2097152 2097152
36 5000 2097152 2097152
37 5000 2097152 2097152
38 5000 2097152 2097152
39 5000 2097152 2097152
40 5000 2097152 2097152
41 5000 2097152 2097152
42 5000 2097152 2097152
43 5000 2097152 2097152
44 5000 2097152 2097152
45 5000 2097152 2097152
46 5000 2097152 2097152
47 5000 2097152 2097152
48 5000 2097152 2097152
49 5000 2097152 2097152