| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 124 | 104 | 82 | 83.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:
STU, FAC, or VIS denoting students, faculty, and visitors, respectively.IN or OUT representing a person entering or exiting, respectively.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.
3 STU IN 10 VIS IN 38 STU OUT 4
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ドル$.
5 STU IN 10 VIS IN 38 STU OUT 4 VIS OUT 38 STU OUT 6
NO STRAGGLERS
School > CS@Mines > CS@Mines HSPC 2024 N번