No.3707 Unique Ticket
タグ : / 解いたユーザー数 74
作問者 :
UT0911
/ テスター :
Problem Statement
Yuuty is visiting an amusement park. This amusement park has $N$ tickets numbered from $1$ to $N$, and $M$ types of events numbered from $1$ to $M$.
The events that can be attended with each ticket are represented by $N$ strings $S_1, S_2, \cdots, S_N$ of length $M$.
If the $j$-th character of $S_i$ is o, event $j$ can be attended with ticket $i$; if it is x, it cannot.
There may be tickets with which no event can be attended.
Yuuty has decided to check whether each ticket is a "unique ticket". Ticket $X$ is called a "unique ticket" if it satisfies the following condition.
- There is at least $1$ event that can be attended with ticket $X$, and every event that can be attended with ticket $X$ can be attended only with ticket $X$.
Find the number of "unique tickets".
Constraints
- $N, M$ are integers
- $1 \leq N \leq 100$
- $1 \leq M \leq 100$
- $S_i$ is a string of length $M$ consisting of
oandx
Input
$N\; M$ $S_1$ $S_2$ $\vdots$ $S_N$
Output
Output the number of "unique tickets".
Print a newline at the end.
Sample
Sample 1
Input
5 5 ooxxx xxoxx xxoox xxxxx xxxxo
Output
2
Ticket $1$: The events $1$ , $2$ that it can attend cannot be attended with any other ticket, so ticket $1$ is a "unique ticket".
Ticket $2$: The event $3$ that it can attend can also be attended with ticket $3$, so ticket $2$ is not a "unique ticket".
Ticket $3$: The event $3$ that it can attend can also be attended with ticket $2$, so ticket $3$ is not a "unique ticket".
Ticket $4$: No event can be attended with it, so ticket $4$ is not a "unique ticket".
Ticket $5$: The event $5$ that it can attend cannot be attended with any other ticket, so ticket $5$ is a "unique ticket".
Sample 2
Input
1 8 oxoxoxox
Output
1
There may be only $1$ ticket.
Sample 3
Input
10 10 oxxxxxxxxx xoxxxxxxxx xxoxxxxxxx xxxoxxxxxx xxxxoxxxxx xxxxxoxxxx xxxxxxoxxx xxxxxxxoxx xxxxxxxxox xxxxxxxxxo
Output
10
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。