_ROHIT_'s blog

By _ROHIT_, history, 7 years ago, In English

I used Disjoint sets for the 0-difference edges and check for bipartite graph for 1-difference edges. The array zero is for 0-difference disjoint set, array hero holds the parent of every element, array arank defines the rank of every set (used for union-by-rank) and the array whatup checks if all the same set element(0-difference elements) have the same color(have no difference at all).

Here is the code : CODE

Full text and comments »

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