Logo
(追記) (追記ここまで)

33082번 - Powers of Two 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB38292086.957%

문제

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.

제한

예제 입력 1

6
+ 3
+ 3
- 4
- 6
+ 7
- 6

예제 출력 1

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ドル$.

예제 입력 2

13
+ 13324
+ 5773
- 5772
+ 13324
+ 0
- 5772
- 13325
- 0
+ 0
+ 0
- 200000
- 1
+ 200000

예제 출력 2

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번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /