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

32802번 - Mouse Pursuit 다국어

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

문제

Brandon is playing the newest idle game, Mouse Pursuit! The goal of this game is to pursue mice for cheese and glory.

In Mouse Pursuit, an event consists of pursuing a mouse. If the mouse is caught, the player might earn cheese and glory. However, if the mouse is not caught, the player might lose cheese and glory.

Given Brandon's recent events, Brandon wants to know how much cheese and glory he earned in the last $k$ seconds.

입력

The first line of input contains a single integer, $n$ $(1 \le n \le 10^5)$.

The next $n$ lines take one of two forms:

  • $\text{CAUGHT}$ $s$ $c$ $g$: A mouse was caught exactly $s$ seconds ago. The player gained $c$ pieces of cheese and $g$ units of glory.
  • $\text{MISS}$ $s$ $c$ $g$: A mouse was missed exactly $s$ seconds ago. The player lost $c$ pieces of cheese and $g$ units of glory.

For all events, 0ドル \le c, g \le 10^6$ and 1ドル \le s \le 10^9$. It is guaranteed that no two events happened at exactly the same time.

The last line contains a single integer $k$. It is guaranteed that no event happened exactly $k$ seconds ago.

출력

Output two integers - the number of pieces of cheese Brandon gained in the last $k$ seconds, and the number of units of glory Brandon gained in the last $k$ seconds.

제한

예제 입력 1

3
CAUGHT 1 6 5
MISS 4 1 2
CAUGHT 8 0 3
5

예제 출력 1

5 3

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 E번

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

출처

대학교 대회

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

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