#P9811. [CCC 2015 S2] Jerseys
[CCC 2015 S2] Jerseys
Problem Description
There are jerseys numbered from to that will be given to players. The jersey sizes, from small to large, are S, M, and L. Each player has a requirement for a jersey. Specifically, the -th player wants a jersey whose size is not smaller than , and the jersey number is .
Find the maximum number of players whose requirements can be satisfied.
Input Format
The first line contains an integer , and the second line contains an integer .
The next lines each contain a character , meaning the size of jersey number , where .
The next lines each contain a character and an integer , where . The meaning is the same as in the description.
Output Format
Output one line with one integer, the maximum number of players whose requirements can be satisfied.
4
3
M
S
S
L
L 3
S 3
L 1
1
Hint
Constraints:
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5