luogu#P8410. 「SvR-1」Don't Mozheng. /oh
「SvR-1」Don't Mozheng. /oh
Background
Problem Number: .
In the Guluo Academic group chat, everyone is getting "mozheng" (魔怔).

The Luogu blog post "Introduction to Mozheng": https://www.luogu.com.cn/blog/supervise/how-to-get-a-mz.
If you need the PDF of "Introduction to Mozheng" (currently updated to version v1.1.1), please download it from "Problem Attachments" below.
Problem Description
You are given messages. There are three types of messages (note that describes a string named . This string contains no spaces, and does not contain the characters or . It also does not include the angle brackets on either side):
- In the form . This means that the single message on the next line is sent by the user named .
- In the form This means an emoji message with name .
- In the form . This means a text message whose content is .
After long observation, you found that the emoji messages named and have a "mozheng" meaning.
Also, within a conversation:
- One emoji increases the mozheng value by .
- One emoji increases the mozheng value by .
- Any other message will not affect the mozheng value, and the initial mozheng value is .
Now, for these messages, you need to compute the total mozheng value.
Input Format
The first line contains three integers , meaning there are messages in total, and are as described above.
The next lines describe each message:
- The first line is a type 1 message.
- The second line is a type 2 or type 3 message.
Output Format
Output one integer on a single line, the total mozheng value.
7 1 2020
wop:
/yueliang
eoq:
wop_loushang
wop:
eoq_npy_when
eoq:
/oh
dek:
/oh
rif:
NOI2022_rp_++
rif:
/hsh
2022
Hint
Explanation for Sample 1

As shown in the figure.
Constraints
This problem uses bundled testdata.
Let be the maximum length of a single-line message in the input.
$$\newcommand{\arraystretch}{1.5} \begin{array}{c|c|c|c}\hline\hline \textbf{Subtask} & \bm{n\le} & \textbf{Special Property} & \textbf{Score} \\\hline \textsf{1} & \le 10 & - & 20 \\\hline \textsf{2} & \le 100 & - & 20 \\\hline \textsf{3} & \text{No special limit} & \text A & 20 \\\hline \textsf{4} & \text{No special limit} & - & 40 \\\hline\hline \end{array}$$- Special property : The input does not contain type 3 messages.
For of the data, , , .
Translated by ChatGPT 5