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

3557번 - Homo or Hetero? 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB124604156.944%

문제

Consider a list of numbers with two operations:

  • insert number --- adds the specified number to the end of the list.
  • delete number --- removes the first occurrence of the specified number from the list. If the list does not contain the number specified, no changes are performed.

For example: the result of the insertion of a number 4 to the list $[1, 2, 1]$ is the list $[1, 2, 1, 4]$. If we delete the number 1ドル$ from this list, we get the list $[2, 1, 4],ドル but if we delete the number 3ドル$ from the list $[1, 2, 1, 4],ドル the list stays unchanged.

The list is homogeneous if it contains at least two equal numbers and the list is heterogeneous if it contains at least two different numbers. For example: the list $[2, 2]$ is homogeneous, the list $[2, 1, 4]$ is heterogeneous, the list $[1, 2, 1, 4]$ is both, and the empty list is neither homogeneous nor heterogeneous.

Write a program that handles a number of the operations insert and delete on the empty list and determines list's homogeneity and heterogeneity after each operation.

입력

The first line of the input file contains an integer number $n$ --- the number of operations to handle (1ドル \le n \le 100,000円$).

Following $n$ lines contain one operation description each. The operation description consists of a word insert or delete, followed by an integer number $k$ --- the operation argument ($-10^9 \le k \le 10^9$).

출력

For each operation output a line, containing a single word, describing the state of the list after the operation:

  • both --- if the list is both homogeneous and heterogeneous.
  • homo --- if the list is homogeneous, but not heterogeneous.
  • hetero --- if the list is heterogeneous, but not homogeneous.
  • neither --- if the list is neither homogeneous nor heterogeneous.

제한

예제 입력 1

11
insert 1
insert 2
insert 1
insert 4
delete 1
delete 3
delete 2
delete 1
insert 4
delete 4
delete 4

예제 출력 1

neither
hetero
both
both
hetero
hetero
hetero
neither
homo
neither
neither

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > NEERC Northern Subregional 2009 H번

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

출처

대학교 대회

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

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