Getting wrong answer in 'At the Gates'

Here’s my code:
[CodeChef: Practical coding for everyone]
Question: (CodeChef: Practical coding for everyone)
Kindly help me out.

replace

for(auto i:v) i^=1;

with

 for(int i=0;i<v.size();i++){
     v[i]^=1
}

Because you’re generating a new integer and changing that, not your sequence.