| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 109 | 79 | 61 | 74.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:
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.
3 CAUGHT 1 6 5 MISS 4 1 2 CAUGHT 8 0 3 5
5 3
ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 E번