The program looks good to me, i.e. I cannot imagine cases for false positives or negatives.
I have only some minor remarks:
usedvector inis_permutationis one element too big (in other words, its element at position 0 is never used); you could declare the vector of the right size, and always access element at indexper[i]] - 1, instead ofper[i]].I suggest your main function does return a value, e.g. 0 on success, 1 on error.
I recommend always using brackets for
if/else/loops etc. statements, e.g. in places likeif (not is_permutation(v[y])) return false;. In this way, you avoid confusion if you would like to add other statements to theif/elseclause later.Although not a problem in any way, I had never seen the operator
notused like this in C++ (I knew only about!). However, I just discovered that operatornotdoes, in fact, exist. I learnt something new today as well.
EDIT: As pointed out in comments: it is not a good practice to use the verbose form of the operators (e.g. and instead of &&) since they are provided only for compatibility with old keyboards, and virtually never used in a productive environment.