SARRAY  Suffix Array
Given a string of length at most 100,000 consist of alphabets and numbers. Output the suffix array of the string.
A suffix array is an array of integers giving the starting positions (0based) of suffixes of a string in lexicographical order. Consider a string "abracadabra0AbRa4Cad14abra". The size of the suffix array is equal to the length of the string. Below is the list of 26 suffixes of the string along with its starting position sorted in lexicographical order:
POS SUFFIX 11 0AbRa4Cad14abra 20 14abra 16 4Cad14abra 21 4abra 12 AbRa4Cad14abra 17 Cad14abra 14 Ra4Cad14abra 25 a 10 a0AbRa4Cad14abra 15 a4Cad14abra 22 abra 7 abra0AbRa4Cad14abra 0 abracadabra0AbRa4Cad14abra 3 acadabra0AbRa4Cad14abra 18 ad14abra 5 adabra0AbRa4Cad14abra 13 bRa4Cad14abra 23 bra 8 bra0AbRa4Cad14abra 1 bracadabra0AbRa4Cad14abra 4 cadabra0AbRa4Cad14abra 19 d14abra 6 dabra0AbRa4Cad14abra 24 ra 9 ra0AbRa4Cad14abra 2 racadabra0AbRa4Cad14abra
Note: this is a partial score problem.
O(n^{2} log(n)) is expected to score about 2030. (Naive sorting all suffixes)
O(n log^{2}(n)) is expected to score about 40. (OK for most programming contest problems)
O(n log n) is expected to score about 6070. (Use counting sort for small alphabet size)
O(n) without tweaks is expected to score about 8090.
O(n) with tweaks is expected to score 100. (This is meant for fun only :)
Input
A single line containing the string.
Output
The suffix array of the string.
Example
Input: abracadabra0AbRa4Cad14abra Output: 11 20 16 21 12 17 14 25 10 15 22 7 0 3 18 5 13 23 8 1 4 19 6 24 9 2
hide comments
Vasya:
20130406 23:30:01
O(n log n) gets 60, O(n log^2 n) gets 60. What's wrong? 

Mahavir Chopra:
20130224 09:22:07
gives 30 for nlogn


gourav:
20121224 05:54:28
RE means ? 

Seter:
20120615 05:56:24
I rewrote the function "printf" and got 100 instead of 90...a little fun hah? 

Thomas Dybdahl Ahle:
20111117 15:01:51
Neither my n^2logn or nlog^2n solutions get more than 0 points... I wonder if the test cases are just really hard, or if I'm not reading the input right.. 

Balasubramanian:
20111112 16:12:18
My submission id is 6013479


Shafaet:
20111025 11:50:03
my O(n log2(n)) got 60 which is higher than felix expected 

Sigma Kappa:
20110522 17:15:10
My O(nlogn) algo gets 80 points. How do I know whether they are _not_ caused by RTEs or whatever? Because I can see that things that ran for more than my timing got 100 points, so I suspect my program still has some bugs... Last edit: 20110517 16:31:25 

Felix Halim:
20110522 17:15:10
When I first set the problem, I didn't know that the timelimit can be set to be less than 1 second. Now, I have set the timelimit to be stricter and rejudged this problem. 

Sigma Kappa:
20110522 17:15:10
"Hmm should I make the input larger to distinguish O(n log n) solution?"

Added by:  Felix Halim 
Date:  20100326 
Time limit:  0.200s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: PERL6 