kushwah_1's blog

By kushwah_1, history, 3 months ago, In English,

It would be great if someone can help me with GSMATRIX problem on spoj GSMATRIX

 
 
 
 

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Although it is not intended solution, you can write slow brute-force solution using recursion with sets of bitsets to get answers for all N. Since N can be up to 120, the maximum answer-maximum depth for recursion will be ceil(log2(120)) = 7.