102771: [AtCoder]ABC277 B - Playing Cards Validation

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:2 Solved:0

Description

Score : $200$ points

Problem Statement

You are given $N$ strings, each of length $2$, consisting of uppercase English letters and digits. The $i$-th string is $S_i$.
Determine whether the following three conditions are all satisfied.
・For every string, the first character is one of H, D, C, and S.
・For every string, the second character is one of A, 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K.
・All strings are pairwise different. That is, if $i \neq j$, then $S_i \neq S_j$.

Constraints

  • $1 \leq N \leq 52$
  • $S_i$ is a string of length $2$ consisting of uppercase English letters and digits.

Input

The input is given from Standard Input in the following format:

$N$
$S_1$
$S_2$
$\vdots$
$S_N$

Output

If the three conditions are all satisfied, print Yes; otherwise, print No.


Sample Input 1

4
H3
DA
D3
SK

Sample Output 1

Yes

One can verify that the three conditions are all satisfied.


Sample Input 2

5
H3
DA
CK
H3
S7

Sample Output 2

No

Both $S_1$ and $S_4$ are H3, violating the third condition.


Sample Input 3

4
3H
AD
3D
KS

Sample Output 3

No

Sample Input 4

5
00
AA
XX
YY
ZZ

Sample Output 4

No

Input

题意翻译

给出 $N\,(1 \le N \le 52)$ 个长度为 $2$ 的字符串 $S_1,S_2,\dots ,S_N$,判断该 $N$ 个字符串是否满足以下条件: - 第一个字符为 `H`,`D`,`C`,`S` 其中之一。 - 第二个字符为 `A`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`T`,`J`,`Q`,`K` 其中之一。 - 字符串两两不相等。即 $\forall i \not=j,S_i \not= S_j$。 若满足以上条件,输出 `Yes`,否则输出 `No`。

Output

得分:200分 部分 问题描述 你将获得N个长度为2的字符串,由大写英文字母和数字组成。第i个字符串为S_i。 确定以下三个条件是否都满足。 ・对于每个字符串,第一个字符是H、D、C或S之一。 ・对于每个字符串,第二个字符是A、2、3、4、5、6、7、8、9、T、J、Q或K之一。 ・所有字符串彼此不同。即,如果i≠j,则S_i≠S_j。 部分 限制 * 1≤N≤52 * S_i是长度为2的字符串,由大写英文字母和数字组成。 输入输出格式 输入 输入格式如下: $N$ $S_1$ $S_2$ ⋯ $S_N$ 输出 如果三个条件都满足,打印Yes;否则,打印No。 部分 样例输入1 ``` 4 H3 DA D3 SK ``` 样例输出1 ``` Yes ``` 可以验证三个条件都满足。 部分 样例输入2 ``` 5 H3 DA CK H3 S7 ``` 样例输出2 ``` No ``` S_1和S_4都是H3,违反了第三个条件。 部分 样例输入3 ``` 4 3H AD 3D KS ``` 样例输出3 ``` No ``` 部分 样例输入4 ``` 5 00 AA XX YY ZZ ``` 样例输出4 ``` No ```

加入题单

算法标签: