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

Автор sniper_0101, история, 10 месяцев назад, По-английски

There is a game on a tree On each move a proper subtree(i.e. any subtree but not whole tree) has to be clipped off the tree
The player who can't make a move loses.

I am thinking in terms of grundy numbers for each subtree and since each children are independent so xoring all the Gs of them to get the G of root

But this does not seem to work and in the solution they are doing G(root) = XOR(G(1 + child_i)

I don't get it why this +1 is added before xor

Could not find any good explanatory tutorial on this.

Any explanation or redirection to any relevant resources will be appreciated

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

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

Автор sniper_0101, история, 18 месяцев назад, По-английски

Hello ! I have come across a graph problem which has n(<=16) nodes (And It is connected) and we need to find the MAX NUMBER of nodes on any possible path (Path should not contain cycles) between any two pair of nodes in the graph . How can I solve it ? Can anybody suggest any idea ?

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

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

Автор sniper_0101, история, 20 месяцев назад, По-английски

Hello! I have come across a tree problem where number of nodes(V<=1e5) and number of edges(E<=1e5) and edge weights are given .There are Q (Q<=1e5) queries of two types:

Query 1 asks to change the weight of edge i to W (given in query) Query 2 asks to print the path length between nodes a and b (given in query)

//As I know, LCA can be used to find the distance when edge weights are not changing (But does not seem to be useful here)

Can anyone suggest any method on how to solve it efficiently ?

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

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