11855 - Buzzwords
Moderator: Board moderators
11855 - Buzzwords
why is the First Input
5
4
4
2
2
???
Edit :
GOT AC ... in 0.9
The Test Cases Are Wrong ...
But How to get AC in Less Time ... ???
I Used Trie !! counted the max of each Level .... 26 * N(N-1)/2
is There Any other solution ?????
5
4
4
2
2
???
Edit :
GOT AC ... in 0.9
The Test Cases Are Wrong ...
But How to get AC in Less Time ... ???
I Used Trie !! counted the max of each Level .... 26 * N(N-1)/2
is There Any other solution ?????
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
I use hash in my solution!
Re: 11855 - Buzzwords
Hi ,Igor ...
0.536 is Good Time
do you hash all n(n-1)/2 strings ?
Then How do you Hash them whats your Function for hashig ... ?
0.536 is Good Time
do you hash all n(n-1)/2 strings ?
Then How do you Hash them whats your Function for hashig ... ?
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
Yes!
Code: Select all
long long getHash(string s)
{
const int p = 31;
long long hash = 0, p_pow = 1;
for (int i=0; i<s.length(); ++i)
{
hash += (s[i] - 'a' + 1) * p_pow;
p_pow *= p;
}
return hash;
}
Re: 11855 - Buzzwords
wouldn't long long overflow for strings of size = 999 ?
31^999 ??
Does your Code Work for Case:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
?
31^999 ??
Does your Code Work for Case:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
?
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
Of cousre it will,but this is not a problem it works like you get it by module!
Re: 11855 - Buzzwords
I have Got AC this Problem ...
so would you please send me your code
angeh.a2@gmail.com
i Just want to learn more from your code implementation
so would you please send me your code
angeh.a2@gmail.com
i Just want to learn more from your code implementation
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
Sorry,but I don't save the codes of Ac problems in my computer((
Re: 11855 - Buzzwords
But I could explain my idea here if you want???
Re: 11855 - Buzzwords
ok no problem ...
i have Tried what you said ...
but i Get Runtime Error ...
is your Code Somthing like this .... ?
i have Tried what you said ...
but i Get Runtime Error ...
is your Code Somthing like this .... ?
Code: Select all
maxes[ k ] is the most repete of string lenght k ...
map<long long ,int> MAP;
long long P=31;
FOR(i,n){
long long Hash=0,Pow=1;
for(int j=i;j<n;++i){
Hash += (line[j]-'A'+1)*Pow;
MAP[Hash]++;
maxes[j-i]<MAP[Hash] ? maxes[j-i]=MAP[Hash] :0 ;
Pow*=P;
}
}
printf out put ....
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
Yes,it was something likes yours!
try to increase the size of array m!
try to increase the size of array m!
Re: 11855 - Buzzwords
Array m ?????Igor9669 wrote:Yes,it was something likes yours!
try to increase the size of array m!
do you use STL map to save the Hashes ?
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
sorry,maxes I mean!
No I don't use map!
No I don't use map!
Re: 11855 - Buzzwords
thanks for your help and sorry for this much Question ...
but if you dont use map , how do save the Hashes ???
i'm confused![:(](./images/smilies/icon_frown.gif)
but if you dont use map , how do save the Hashes ???
i'm confused
![:(](./images/smilies/icon_frown.gif)
>>>>>>>>> A2
Beliefs are not facts, believe what you need to believe;)
Beliefs are not facts, believe what you need to believe;)
Re: 11855 - Buzzwords
)) map is also a good choice, but I use an array with type of pair<long long,int>!