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

3551번 - Bureaucracy 다국어

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

문제

Long ago, in a kingdom far, far away the king decided to keep a record of all laws of his kingdom. From that moment whenever a new law was passed, a corresponding record was added to the law archive.

Many centuries later lawyers discovered that there were only two types of laws in the kingdom:

  • direct law, that states a new norm;
  • canceling law, that cancels one of the previous laws.

The law is considered active if and only if there is no active law that cancels it.

You are to write program that finds out which laws are still active.

입력

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

The following $n$ lines describe one law each. Each description has one of the following formats:

  • declare, meaning that a direct law was passed.
  • cancel $i,ドル where $i$ is the number of law being cancelled by this one.

The laws are numbered from one.

출력

The first line of the output file must contain the number of active laws. Following lines must contain numbers of these laws listed in increasing order.

제한

예제 입력 1

5
declare
cancel 1
declare
cancel 2
cancel 3

예제 출력 1

3
1 4 5

힌트

출처

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

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

출처

대학교 대회

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

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