WA in Fill the matrix

Revision en1, by rohit_thapliyal2000, 2017-09-13 17:57:02

I used Disjoint sets for the 0-difference edges and check for bipartite graph for 1-difference edges. The array zero is or 0-difference disjoint set, array hero holds the parent of every element, array arank defines the rank of every set (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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English rohit_thapliyal2000 2017-09-13 17:58:41 0
en2 English rohit_thapliyal2000 2017-09-13 17:58:41 6
en1 English rohit_thapliyal2000 2017-09-13 17:57:02 484 Initial revision (published)