| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 43 | 32 | 21 | 87.500% |
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 $2^x$, where $x ≥ 0$. Some examples of powers of two are $1, 2, 4, 8, \dots$.
To ensure Adrian understands this new concept, Morgan prepares a challenge for him. At first, Adrian is given an integer $N = 0$. Then, Morgan will give him $Q$ queries. Each query can be one of the following types:
+ $x$, which will add the value of $N$ by $2^x$, or- $x$, which will subtract the value of $N$ by $2^x$.Adrian is instructed to clap his hands whenever $N$ becomes $0$ 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 $Q$ ($1 ≤ Q ≤ 200\, 000$) representing the number of queries. Each of the next $Q$ lines contains a character and an integer $T$ $x$ ($T ∈ \{$+, -$\}$; $0 ≤ x ≤ 200\, 000$) representing the query.
After each query, output YES in a single line if the value of $N$ becomes $0$, or output NO otherwise.
6 + 3 + 3 - 4 - 6 + 7 - 6
NO NO YES NO NO YES
The value of $N$ after each query is $8$, $16$, $0$, $-64$, $64$, and $0$. Therefore, Adrian should clap after query $3$ and $6$.
13 + 13324 + 5773 - 5772 + 13324 + 0 - 5772 - 13325 - 0 + 0 + 0 - 200000 - 1 + 200000
NO NO NO NO NO NO NO YES NO NO NO NO YES
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2022 C번
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2023 연습 세션 PD번