TimberLee's blog

By TimberLee, history, 8 years ago, In English

I recently read somewhere that some DP solutions like knapsack can be optimised and the overall complexity can be reduced by a factor of 32 using std::bitset in C++.

Can someone explain this optimisation and the kinds of DP on which this works ?

Full text and comments »

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

By TimberLee, history, 8 years ago, In English

Problem Link.

I've seen the public solutions but I am unable to understand them.

This is a game theory problem with Grundy Numbers but I am unable to break this game into smaller independent games in order to apply the Grundy theorem.

Can somebody please provide the solution with explanation ?

Full text and comments »

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

By TimberLee, history, 8 years ago, In English

I am trying to solve this problem using ternary search.

It asks to find the maximum of the function x^a·y^b·z^c. Where, x+y+z <= S.

I submitted the following solution which is giving WA. link

However, this AC solution is very similar.

Can somebody help ?

Full text and comments »

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