QOJ.ac

QOJ

時間限制: 3.0 s 記憶體限制: 2048 MB 總分: 100

#10595. 老鼠追逐

统计

Brandon 正在玩最新的放置类游戏《Mouse Pursuit》!这个游戏的目标是追捕老鼠以获得奶酪和荣誉。 在《Mouse Pursuit》中,一个事件包含追捕一只老鼠。如果老鼠被抓住了,玩家可能会获得奶酪和荣誉。然而,如果老鼠没有被抓住,玩家可能会失去奶酪和荣誉。 给定 Brandon 最近的事件,Brandon 想知道他在过去 $k$ 秒内获得了多少奶酪和荣誉。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$)。 接下来的 $n$ 行,每行采用以下两种形式之一: CAUGHT s c g:一只老鼠在 $s$ 秒前被抓住。玩家获得了 $c$ 个奶酪和 $g$ 点荣誉。 MISS s c g:一只老鼠在 $s$ 秒前被错过。玩家失去了 $c$ 个奶酪和 $g$ 点荣誉。

对于所有事件,$0 \le c, g \le 10^6$ 且 $1 \le s \le 10^9$。保证没有两个事件发生在完全相同的时间。 最后一行包含一个整数 $k$。保证没有事件发生在恰好 $k$ 秒前。

输出格式

输出两个整数——Brandon 在过去 $k$ 秒内获得的奶酪总数,以及 Brandon 在过去 $k$ 秒内获得的荣誉总数。

样例

样例输入 1

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

样例输出 1

5 3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.