wakaranai's blog

By wakaranai, history, 6 weeks ago, In English

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?

Read more »

 
 
 
 
  • Vote: I like it
  • +11
  • Vote: I do not like it

By wakaranai, history, 6 months ago, In English

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.

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it