問題一覧 > 通常問題

No.3707 Unique Ticket

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 74
作問者 : UT0911 / テスター : sclara Rino-program 👑 AngrySadEight
お気に入りにしたユーザー ProblemId : 13579 / 自分の提出
問題文最終更新日: 2026-08-11 22:08:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 513 ゆーてぃーお誕生日コンテスト2026 (順位表) の他の問題:

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 o and x

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もしくは右上の雲マークをクリックしてアカウントを作成してください。