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

Автор trailblazer995, история, 4 года назад, По-английски

Hi, I came across a problem in hackerrank test, the problem statement was:

Given an undirected graph with N nodes and M edges, each edge contains a gadget with id i (where 1 <= i <= G), after that you're given Q queries, in each query you've two nodes u and v, you've to find number of distinct gadgets in all simple paths from u to v. Constraints: 1 <= N, Q, M <= 10^5 1 <= G <= 40 Time Limit: 1 sec

I was unable to solve it and couldn't find a solution on internet as well, can anyone tell how to solve it or whether it's not possible solve it

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

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

Автор trailblazer995, история, 4 года назад, По-английски

Hi all, i came across a real life problem where we have N workers and M jobs and edges are given for valid matching with it's weight. Maximum weight matching here can be found using Hungarian's algorithm where complexity will be O(max(N,M)^3). Here N <= 100 and M <= 2000. Can we have some optimisation here for this case such that we don't need to create dummy entries to make MxM matrix? Or is there any other solution?

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

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