RUN TIME ERROR in c++ code

https://www.codechef.com/problems/BOOKCHEF for this problem , i am getting a runtime error .
Here’s my code https://www.codechef.com/viewsolution/18917667

You are trying to access a vector as a array in line 29 as

if(f==special[j])

this is possible giving you a RE. Try using

vector<int> special(n);

Now you can use it as array.

Thanks for your help ,but its not working . And,
https://www.codechef.com/problems/RAINBOWA :: problem
https://www.codechef.com/viewsolution/18863153 :: Solution
here i used vector as an array, it got accepted