Codeforces Round 533 (Div. 2)
E
Helping Hiasat
Codeforces
2200
原题
← D→
翻译中…

Hiasat registered a new account in NeckoForces and when his friends found out about that, each one of them asked to use his name as Hiasat's handle.

翻译中…

Luckily for Hiasat, he can change his handle in some points in time. Also he knows the exact moments friends will visit his profile page. Formally, you are given a sequence of events of two types:

翻译中…
  • $1$ — Hiasat can change his handle.
  • $2$ $s$ — friend $s$ visits Hiasat's profile.
翻译中…

The friend $s$ will be happy, if each time he visits Hiasat's profile his handle would be $s$.

翻译中…

Hiasat asks you to help him, find the maximum possible number of happy friends he can get.

翻译中…

Input

翻译中…

The first line contains two integers $n$ and $m$ ($1 \le n \le 10^5, 1 \le m \le 40$) — the number of events and the number of friends.

翻译中…

Then $n$ lines follow, each denoting an event of one of two types:

翻译中…
  • $1$ — Hiasat can change his handle.
  • $2$ $s$ — friend $s$ ($1 \le |s| \le 40$) visits Hiasat's profile.
翻译中…

It's guaranteed, that each friend's name consists only of lowercase Latin letters.

翻译中…

It's guaranteed, that the first event is always of the first type and each friend will visit Hiasat's profile at least once.

翻译中…

Output

翻译中…

Print a single integer — the maximum number of happy friends.

翻译中…

Note

翻译中…

In the first example, the best way is to change the handle to the "motarack" in the first event and to the "light" in the fourth event. This way, "motarack" and "light" will be happy, but "mike" will not.

翻译中…

In the second example, you can choose either "alice", "bob" or "tanyaromanova" and only that friend will be happy.

翻译中…

样例

Input #1
5 3
1
2 motarack
2 mike
1
2 light
Output #1
2
InputCopy OutputCopy
Input #2
4 3
1
2 alice
2 bob
2 tanyaromanova
Output #2
1
InputCopy OutputCopy
题目信息
题号
1105E
时间限制
2 s
内存限制
256 MB
标签
位运算
暴力
动态规划
折半搜索

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。