Problems

# Frame-workout 2

# Frame-workout 2

Find apair ofverticesina complete undirectedweightedgraphaccording tospecifiedcriteria.

**Input**

In the inputfileis givena number**N** (from **2**to**100**)andthe adjacency matrix ofa completeundirectedweightedgraph(complete graph-a graph inwhichthere areedgesbetween allpairs ofvertices).All theweights of the edges-natural numbersfrom**1**to**1000**.Further,given**N**numbers,eachof which iseither**0**or**1**- it is believedthat thesenumbers are written inthe tops.It is guaranteedthatat least one**0**andatleastone**1**.

**Output**

Locateand bringin the outputfilearethe two verticesthat:

- the first oftheseis0
- the secondofwhichis worth 1
- weight ofthe edgebetween thevertices ofthe minimumpossible.

Ifseveralsuchpairs, displayany ofthem.

Input example #1

3 0 1 2 1 0 4 2 4 0 1 0 0

Output example #1

2 1