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

32322번 - Hotel Rooms 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB79605979.730%

문제

When the UCF Programming Team travels, the coaches would like to get hotel rooms that are close to each other. There is a hotel where rooms are numbered 1 through n and these rooms are in a straight line, i.e., Room 2 is next to Room 1, Room 3 is next to Room 2, and so on. So, it is easier to find large number of available rooms that are close to each other.

Given the room reservations, you are to determine the availability of rooms to accommodate the UCF Programing Team (a large group).

입력

The first input line contains two integers: n (1 ≤ n ≤ 5 ×105), indicating the number of hotel rooms and t (1 ≤ t ≤ 105), indicating the number of transactions. Each of the next t input lines contains a transaction to be processed. There will be two types of transactions:

  • Room Reservation: This input line starts with the letter R in the first column, followed by one space, followed by a valid room number. This transaction is reserving the given room (assume that the room is not already reserved).
  • Group Room Availability: This input line starts with the letter A in the first column, followed by one space, followed by a valid starting room number, followed by a space, followed by a valid ending room number. This transaction is asking how many rooms are available in the given range. Assume that the ending room number will not be less than the starting room number, i.e., the requested range is valid.

출력

There is no output required for the room-reservation transactions. For each group-roomavailability transaction, output a separate line providing the total number of available rooms in the requested range.

제한

예제 입력 1

20 8
A 5 10
R 6
R 9
R 3
A 5 10
R 13
R 18
A 1 20

예제 출력 1

6
4
15

힌트

출처

University > University of Central Florida > 2024 Local Programming Contest (Final Round) 9번

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

출처

대학교 대회

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

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