Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор issahaddar5, история, 9 лет назад, По-английски

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

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

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

Автор issahaddar5, история, 9 лет назад, По-английски

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.

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

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

Автор issahaddar5, история, 9 лет назад, По-английски

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

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

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

Автор issahaddar5, история, 9 лет назад, По-английски

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

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

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