Блог пользователя wakaranai

Автор wakaranai, история, 23 месяца назад, По-английски

Problem link

Array length n <= 100

Array elements can be up to 1e9.

If the elements were ~ 2e5 it could be done by fixing the length of subsets and counting them individually with the mobius function. But I cant think of any way to optimize this approach to work for the given constraints.

Does this problem require a completely different approach/technique?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

Автор wakaranai, история, 2 года назад, По-английски

Problem Link

TLE Code

AC Code

The only difference between the Accepted code and TLE code is that I used a lambda expression in the AC code for deleting an element from a multiset. If I do the exact same thing but without the lambda expression, it times out!! What is going on here? I'm confused.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится