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 ?????
Moderator: Board moderators
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;
}
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 ....
Igor9669 wrote:Yes,it was something likes yours!
try to increase the size of array m!
Users browsing this forum: No registered users and 1 guest