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

34310번 - No Stragglers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB1241048283.673%

문제

Mines Market, the premier on-campus dining hall option, has had some security issues over the past few weeks; some troublemakers have been hiding overnight to score free breakfast and steal ice cream from the fridges! Thus, the Mines Market staff and Mines PD have installed a new, state-of-the-art security and CCTV system which can detect people coming and going from Mines Market. This new security system is remarkable, it can even tell the difference between students, faculty, and visitors!

As the technician for this new security solution, you've been tasked to determine whether, at the end of the day, there are stragglers present in Mines Market or not. Assume there are no students, faculty, or visitors present in Mines Market at the beginning of the day.

입력

The first line of input is an integer, 1ドル \leq N \leq 1,000円,000円,ドル representing the number of entry or exit events logged by the new security system. Each of the subsequent $N$ lines of input represent a single entry or exit event. These $N$ lines will be formatted as three space-separated values:

  • The type of person entering or exiting Mines Market; will be one of STU, FAC, or VIS denoting students, faculty, and visitors, respectively.
  • The direction the person is going; will be either IN or OUT representing a person entering or exiting, respectively.
  • The integer number of people entering or exiting Mines Market of the specified type; this integer will be in the range $[0, 16,383円]$.

Assume that there will be no more than 32ドル,767円$ of any type of person (students, faculty, or visitors) present in Mines Market at any given time. Also assume that it is impossible for there to be a negative quantity of any type of person (students, faculty, or visitors) present in Mines Market at any given time.

출력

Output "NO STRAGGLERS" (without the quotes) if there are no stragglers present in Mines Market at the end of the day. Otherwise, output the total number of stragglers (of any person type) present at the end of the day.

제한

예제 입력 1

3
STU IN 10
VIS IN 38
STU OUT 4

예제 출력 1

44

The first sample input has 3ドル$ entry or exit events logged by the security system, with 10ドル$ students entering, 38ドル$ visitors entering, then 4ドル$ students leaving. That means there are 44ドル$ people (6ドル$ students, and 38ドル$ visitors) still in Mines Market at the end of the day. Thus, the output is 44ドル$.

예제 입력 2

5
STU IN 10
VIS IN 38
STU OUT 4
VIS OUT 38
STU OUT 6

예제 출력 2

NO STRAGGLERS

힌트

출처

School > CS@Mines > CS@Mines HSPC 2024 N번

  • 문제를 만든 사람: Keenan Schott
(追記) (追記ここまで)

출처

대학교 대회

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

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