|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||1||1||1||100.000%|
AlekuKebap is in his math class. While he tries to figure out why 1+1=2, his teacher was writing on the board a slightly more complicated problem. There are given Q queries and a list S with P elemnts equal with 0. Let A be initially an empty set. The querries can be:
0 x(insert value x in set A)
1 x(erase the value x from set A, it is guaranteed that the value x exists in set A)
It is guaranteed that A will never be empty after a query. After every query, the teacher asks Aleku the following question: can I arrange in list S all elements from the set A (not necessary in the order from the A) so that:
If the answer to this question is yes, then find how many different configurations can be obtained. Because the answer can be very big, print the answer modulo 1,000,000,007.If the answer is no, print -1.
Help AlekuKebap to answer correctly to all teacher’s questions to recive a 10 grade.
The first line contains two integers Q and P.
The next Q lines contain the description of every query.
Every line will contain the answer to every question from the Q questions.
9 8 0 3 0 3 0 2 1 2 0 1 0 1 0 1 1 3 1 1
6 6 3 6 12 6 -1 60 60