Hi all!
I am stuck with the following problem. I have a map m from int to vector<int>, i.e. suppose we have map<int, vector<int> > m.
I want to write a function that constructs all the possible pairs from consecutive vectors of the value of this map. To explain more clearly, suppose the map m is the following:
1 2 3 4 5 6 7
|
{
1: [0],
3: [3, 4],
4: [1, 5, 7],
5: [5],
7: [2]
}
|
I would like to construct the following pairs: {(0,3); (0,4); (3,1); (3,5); (3,7); (4,1);
(4,5); (4,7); (1,5); (5,5); (7,5); (5,2)}.
[By the way, my real goal is to find the maximum value (in absolute value)
between the differences of such pairs, i.e max(3-0, 4-0, 3-1, ... etc.)]
How should that possibly be done? Thank you a lot for your help!