### omggg's blog

By omggg, 3 years ago,

I want to use hash table of key : vector and value : int How can i use that ? Map<vector< int >,int> uses extra logn factor which many a times doesn't suite me and gives TLE. I just want to store frequency of a kind of vector.

Any help is appreciated. Thanks.

• +1

| Write comment?
 » 3 years ago, # |   0 You are taking vector as a key value. There is whole extra factor of n where n is the size of the vector everytime you do operations with map.
•  » » 3 years ago, # ^ |   0 That would be okay to me. Just need to make unordered_map instead of map
 » 3 years ago, # |   +4 Can you give link to the problem?
•  » » 3 years ago, # ^ |   0 This is my Submission 77023902 , its easy to understand. Problem : 1225D - Произведения-степени
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 Hey, I solved this problem recently. Hashing the vector won't make a big difference. Try to come with another approach :)But if you still want to try, polynomial hashing in Robin Karp might be useful here but it will don't give correct answer in every case.
 » 3 years ago, # |   +11 https://codeforces.com/blog/entry/62393?#comment-606294You can do it by hashing the vector, but if you do that then the complexity will be $O(n^2/log$ $n)$, which is still too slow.