Funmondi Contest!

There is a contest being held on Funmondi named ‘Funmondy Inter School Programming Contest’. You are one of the head organizers of this contest. So you have to keep track of so many things. One of them is how many different school student is currently present in the venue.

This is a companion discussion topic for the original entry at

the third sample query input is 1 7. which means one student of school1 has left,one student of school7 has entered.
but it tells
" After the third query the present schools are: 1, 2, 3, 4, 5, 6, 8."

but how someone from school 7 just entered. why is there no school no 7?

You didn’t understand.

1 7 means one student from 7th school has left the venue.
For understanding the formats of query input, you’ll find this in the input description

1 v: One student from vth school left the venue.
2 v: One student from vth school entered the venue.

So it means first number 1 indicates leaving and 2 indicates entering and second number indicates the school no.

Hope you get it.

1 Like

This problem can solve without segment tree. Just brute force.

Can’t be solved using python :")