QOJ.ac

QOJ

时间限制: 2.0 s 内存限制: 512 MB 总分: 100

#15799. 超市

统计

Snuke 的超市出售 $n$ 种不同的食物,编号为 $1$ 到 $n$。某些种类的食物是季节性的:在不同的月份,可能会出售不同种类的食物。给你 $n$ 个长度为 $12$ 的字符串 $s_1, \dots, s_n$。如果 $s_i$ 的第 $j$ 个字符是 'o',则食物 $i$ 在第 $j$ 个月出售。否则,该字符为 'x',食物 $i$ 在第 $j$ 个月不出售。

Komaki 是这家超市的顾客。他有一份关于食物偏好的清单。该清单是 $1, \dots, n$ 的一个排列,清单中的第一个数字表示他最喜欢的食物,依此类推。当他来到这家超市时,他总是会在所有当前有售的食物中,购买他的偏好清单中最靠前的那种食物。偏好清单永远不会改变,但他可能会在不同的月份购买不同的食物。当然,如果没有食物出售,他在整个月里什么也买不到。你不知道 Komaki 的偏好清单。计算 Komaki 可能购买的不同食物种类的最大数量。

输入格式

输入的第一行包含一个整数 $n$。接下来的 $n$ 行中,第 $i$ 行包含一个字符串 $s_i$。

数据范围

  • $1 \le n \le 10^4$
  • $|s_i| = 12$
  • $s_i$ 中的每个字符要么是 'o',要么是 'x'

输出格式

输出 Komaki 可能购买的不同食物种类的最大数量。

样例

输入样例 1

3
oxooxoxxoxox
oooooooooooo
xxxoxxxxxxox

输出样例 1

3

输入样例 2

5
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx

输出样例 2

0

说明

在样例 1 中,如果 Komaki 的偏好清单是 $3, 1, 2$,他将在一月份购买 $1$,在二月份购买 $2$,在四月份购买 $3$,因此他将购买所有类型的食物。

在样例 2 中,Komaki 什么也不会买。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.