issahaddar5's blog

By issahaddar5, history, 9 years ago, In English

Hello,

I am trying to solve this bitmasking problem. My algorithm is correct but it keeps timing out. I don't know how to further optimize it. this is my code.

Thanks in advance

Full text and comments »

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

By issahaddar5, history, 9 years ago, In English

I am trying to solve this. The graph is a tree, so I represented it as disjoint sets. To find the distance between two nodes I am finding the first common ancestor and adding the distances to reach this ancestor form the starting node and the target node. this is my code and unfortunately its giving wrong answer upon submission.

Full text and comments »

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

By issahaddar5, history, 9 years ago, In English

I am trying to solve this problem. However, I am getting a wrong answer on test case 11 and I can't figure it out. This is my code

Full text and comments »

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

By issahaddar5, history, 9 years ago, In English

I was trying to solve this problem. I solved it using bfs. However, I would like to know how can I generate the whole graph beforehand — before processing it in dfs or any other algorithm- ? Another problem that I would like to employ this technique on is problem A in this contest

Full text and comments »

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