My submission link:https://codeforces.me/contest/1617/submission/139558699
What i did was pushed all numbers greater than n in a vector and all number lesser than or equal to n with frequency greater than 1 in the same vector. After that i pushed all numbers of input vector in a set and checked for numbers from 1 to n which were not there in permutation and pushed it in another vector b and then i converted vector a to ma modulo for number at each index also sorted vector a and checked if a[i]<b[i] for some index if found that index answer would be -1 as vector b is already sorted so i cannot further make it more lesser otherwise i printed vector b size.
But it is showing WA on test case 9 pretest 304. Please Help if you find out a flaw also a counter test case would be welcomed too. thank you in advance.
-1
2
Thank You so much.
While pushing elements in vector a from the input vector v, you will miss the element at v[0]. For example, if n=4 and input vector v={ 5,2,2,3} then as per ur code vector a will only have a={2}. You are missing 5 here.
Yes, I figured it out from the test case and got AC. Thank you!!