Frame-workout 2
Find a pair of vertices in a complete undirected weighted graph according to specified criteria.
Input
In the input file is given a number N (from 2 to 100) and the adjacency matrix of a complete undirected weighted graph (complete graph - a graph in which there are edges between all pairs of vertices). All the weights of the edges - natural numbers from 1 to 1000. Further, given N numbers, each of which is either 0 or 1 - it is believed that these numbers are written in the tops. It is guaranteed that at least one 0 and at least one 1.
Output
Locate and bring in the output file are the two vertices that:
the first of these is 0
the second of which is worth 1
weight of the edge between the vertices of the minimum possible.
If several such pairs, display any of them.