AMC3 - Editorial

PROBLEM LINK:

Contest

Author: Chhekur

Tester: Pankaj Devesh

Editorialist: Pawan Kushwah

DIFFICULTY:

Easy

PREREQUISITES:

Undirected graphs representation in matrix form.

PROBLEM:

You have given connections between diffrent nodes in two Undirected graphs

and You have to find out if these graphs are the same or not .

EXPLANATION:

The easiest way to match these graph is to superimpose the matrices.

( for reducing repeted computation you can compare any: ‘either upper or lower’ half of the matrix )

But before this you have to find out the dimensions of matrix , which is equal to the

maximum value of ‘a’ or ‘b’ { max := maximum( max, maximum(ai , bi) ) } .

Author’s solution can be found here.