Powers of Two
면접 대비시간 제한1초메모리 제한2048 MB
N = 0에서 시작해 2^x를 더하거나 빼는 질의를 Q번 처리하면서, 각 질의 후 N이 0이 되는지 판정한다.
문제
Adrian has learned addition and subtraction from Morgan and is now ready to learn a new concept, the powers of two. Powers of two are integers in the form of , where . Some examples of powers of two are .
To ensure Adrian understands this new concept, Morgan prepares a challenge for him. At first, Adrian is given an integer . Then, Morgan will give him queries. Each query can be one of the following types:
+, which will add the value of by , or-, which will subtract the value of by .
Adrian is instructed to clap his hands whenever becomes after each query.
Adrian finds this challenge is very hard to follow. He asks you whether he should clap or not after each query.
입력
Input begins with an integer () representing the number of queries. Each of the next lines contains a character and an integer (T ∈ \\{+, -\\}; ) representing the query.
출력
After each query, output YES in a single line if the value of becomes , or output NO otherwise.