Testcase 3 not working

code : https://ide.codingblocks.com/s/137309

Test case-3 is working fine in your code.
make sure the test case is the following:-
input: output
4 1 1 2 2
1 2 2 1
please try again and let me know the test case if it is not the above.

yes ,it is the testcase 3 which is not submitting ,but i checked for input that u suggested me

please help me for testcase 3