How to implement multiset in java efficiently?

Правка en1, от YocyCraft, 2023-01-05 12:05:55

In 1718C - Тоня и Бурёнка-179 I inplemented a solution with intended complexity (which was O(n*log(n)*PrimeFactorCount(n))), which need a multiset to update the possible answer between queries, and answer the max element of the multiset for each query. But since there's no multiset in java, I had to simulate a multiset by a TreeMap, which caused TLE (my submission:188008030)

I looked at other java solution for this problem and no one got AC. Is this problem unsolvable for java or there's better implementation for multiset?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский YocyCraft 2023-01-05 15:17:45 2 Tiny change: '1718C] I inplemented ' -> '1718C] I implemented '
en1 Английский YocyCraft 2023-01-05 12:05:55 579 Initial revision (published)