A vector R is a vector that is composed of two parts:
v = x1 x2 x3 x4 … xn y1 y2 y3 … ym |
such that the part x1 … xn and the part y1 … ym are ordered strictly in increasing order but ym < x1. We also have that n,m > 0. That is, neither part is empty.
We need to implement the function int vectorR(const vector<int>& v)
with the following specification:
PRE:
v is a vector R and ∣ v ∣ ≥ 3.
POST:
The position of y1 in v.
Observation
You only need to send the function we ask for and the actions and functions that you define yourself. The rest will be ignored.
Input
An undetermined number of vectors R with the following format: an integer indicating their size, and then the vector R. Every vector R has a size greater than or equal to 3.
Output
The position within the vector where y1 is.
ENTRADA 1: 15 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 SORTIDA 1: 5 ENTRADA 2: 15 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 SORTIDA 2: 13 ENTRADA 3: 15 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 SORTIDA 3: 1 ENTRADA 4: 15 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 SORTIDA 4: 14