Page 2 of 2

Re: 11855 - Buzzwords

Posted: Mon Oct 04, 2010 3:45 pm
by Angeh
Then what do you do with This Array ?
sort and unify and then Count ???
i wonder why your time is so good ...
would you please Explain more ....

1- you try all N*(N-1) strings and make a hashCode FOR each sub string ...
2- make an aray of pair <hashCode ,Counter >
3- sort the Araay ....
4- combine all similar hashcodes and Count them ...
5- save and out put ...

is this what you do ???

Re: 11855 - Buzzwords

Posted: Mon Oct 04, 2010 8:16 pm
by Igor9669
not a counter, I use it for the lenght of the string which make this hash!
Then sort and it easy to find the answer! So the complexity is O(n*(n-1)/2)*logN or O(n^2logN)

Re: 11855 - Buzzwords

Posted: Mon Oct 04, 2010 8:29 pm
by Igor9669
I just find a mistake in your code)))
look for your inner loop!!!!

Re: 11855 - Buzzwords

Posted: Mon Oct 04, 2010 10:49 pm
by Angeh
:))
now i get it ... Nice ...
got AC in 0. 464 -- used int instead of long long ...
but i still believe that some test Case would break this solution ...
Thanks for your help Igor ...

Re: 11855 - Buzzwords

Posted: Tue Oct 05, 2010 6:31 am
by howardcheng
you can also use a suffix array/tree.

11855 sample output is incorrect

Posted: Mon Dec 27, 2010 5:22 pm
by DJWS
In the problem statement,
the sample output of the first test case is:

5
4
4
2
2

It should be

4
3
3
2
2

My program passed all cases from the judge.
So I think it's just a typo in the problem statement.

Re: 11855 sample output is incorrect

Posted: Tue Jan 06, 2015 5:01 am
by brianfry713
No, the problem statement is correct. T occurs 5 times.