To solve this problem, I used biteset. The size of the bitset should be at least $$$10^4$$$. I used $$$10$$$ so that it's easy to debug. At the end I forgot that the size of bitest should be changed and submitted this code.The Verdict should be Wrong Answer/ Run time error. But it got Accepted.
Does anyone know the reason behind this?