Find apair ofverticesina complete undirectedweightedgraphaccording tospecifiedcriteria.
In the inputfileis givena numberN (from 2to100)andthe adjacency matrix ofa completeundirectedweightedgraph(complete graph-a graph inwhichthere areedgesbetween allpairs ofvertices).All theweights of the edges-natural numbersfrom1to1000.Further,givenNnumbers,eachof which iseither0or1- it is believedthat thesenumbers are written inthe tops.It is guaranteedthatat least one0andatleastone1.
Locateand bringin the outputfilearethe two verticesthat:
- the first oftheseis0
- the secondofwhichis worth 1
- weight ofthe edgebetween thevertices ofthe minimumpossible.
Ifseveralsuchpairs, displayany ofthem.
3 0 1 2 1 0 4 2 4 0 1 0 0