CF1000A.Codehorses T-shirts

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.

The valid sizes of T-shirts are either "M" or from 00 to 33 "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not.

There are nn winners to the cup for both the previous year and the current year. Ksenia has a list with the T-shirt sizes printed for the last year cup and is yet to send the new list to the printing office.

Organizers want to distribute the prizes as soon as possible, so now Ksenia is required not to write the whole list from the scratch but just make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words.

What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one?

The lists are unordered. That means, two lists are considered equal if and only if the number of occurrences of any string is the same in both lists.

Codehorses 刚刚举办了第二届 Codehorses 杯。与去年一样,本届赛事的组织者也将为获奖者发放 T 恤。

T 恤的有效尺码为:要么是 "M",要么是由 00 至 33 个 "X" 后接 "S" 或 "L" 构成的字符串。例如,"M"、"XXS"、"L"、"XXXL" 是有效尺码,而 "XM"、"Z"、"XXXXL" 则不是。

去年和今年均有 nn 名获奖者。克谢尼娅(Ksenia)手中有一份去年杯赛所用的 T 恤尺码列表,而她尚未向印刷厂提交今年的新列表。

主办方希望尽快发放奖品,因此克谢尼娅无需从头编写整个新列表,只需对去年的列表进行若干修改即可。她每秒钟可以任选某个字符串中的任意一个位置,并将该位置上的字符替换为某个大写拉丁字母。她不能在任何字符串中删除或添加字符。

克谢尼娅最少需要多少秒,才能将去年的尺码列表修改为今年的尺码列表?

注意:这两份列表是无序的。也就是说,当且仅当任意字符串在两份列表中出现的次数完全相同时,才认为这两份列表相等。

输入格式

The first line contains one integer nn (1≤n≤1001 \le n \le 100) — the number of T-shirts.

The ii-th of the next nn lines contains aia_i — the size of the ii-th T-shirt of the list for the previous year.

The ii-th of the next nn lines contains bib_i — the size of the ii-th T-shirt of the list for the current year.

It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list bb from the list aa.

第一行包含一个整数 nn(1≤n≤1001 \le n \le 100)—— 表示 T 恤的数量。

接下来的 nn 行中,第 ii 行包含 aia_i —— 表示去年列表中第 ii 件 T 恤的尺码。

再接下来的 nn 行中,第 ii 行包含 bib_i —— 表示今年列表中第 ii 件 T 恤的尺码。

保证输入中所有尺码均合法。同时保证克谢尼娅能够由列表 aa 得到列表 bb。

输出格式

Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.

输出克谢尼娅将去年的列表更改为当前列表所需的最少秒数。如果两个列表已经相同,则输出 0。

输入输出样例

  • 输入#1

    3
    XS
    XS
    M
    XL
    S
    XS

    输出#1

    2
  • 输入#2

    2
    XXXL
    XXL
    XXL
    XXXS

    输出#2

    1
  • 输入#3

    2
    M
    XS
    XS
    M

    输出#3

    0

说明/提示

In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".

In the second example Ksenia should replace "L" in "XXXL" with "S".

In the third example lists are equal.

在第一个例子中,克谢尼娅可以将“M”替换为“S”,并将“XS”中某一处的“S”替换为“L”。

在第二个例子中,克谢尼娅应将“XXXL”中的“L”替换为“S”。

在第三个例子中,两个列表相等。

输入解题思路,AI测评打分。不知道怎么写?

首页