problem code A3

I need some help on Problem A3 (The guessing game) there are few submission which makes no use of seg tree or fenwick tree , can some one plz expalin the logic

@raj13 : Why don’t you take a look at Problem Editorial.