102161: [AtCoder]ABC216 B - Same Name
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:1
Solved:0
Description
Score : $200$ points
Problem Statement
There are $N$ people. The family name and given name of the $i$-th person $(1 \leq i \leq N)$ are $S_i$ and $T_i$, respectively.
Determine whether there is a pair of people with the same family and given names. In other words, determine whether there is a pair of integers $(i,j)$ such that $1 \leq i \lt j \leq N$, $S_i=S_j$, and $T_i=T_j$.
Constraints
- $2 \leq N \leq 1000$
- $N$ is an integer.
- Each of $S_i$ and $T_i$ is a string of length between $1$ and $10$ (inclusive) consisting of English lowercase letters.
Input
Input is given from Standard Input in the following format:
$N$ $S_1$ $T_1$ $S_2$ $T_2$ $\hspace{0.6cm}\vdots$ $S_N$ $T_N$
Output
If there is a pair of people with the same family and given names, print Yes
; otherwise, print No
.
Sample Input 1
3 tanaka taro sato hanako tanaka taro
Sample Output 1
Yes
The first and third persons have the same family and given names.
Sample Input 2
3 saito ichiro saito jiro saito saburo
Sample Output 2
No
No two persons have the same family and given names.
Sample Input 3
4 sypdgidop bkseq bajsqz hh ozjekw mcybmtt qfeysvw dbo
Sample Output 3
No
Input
题意翻译
有 $n$ 个人,每行给出其中一个人的姓名,问有没有重名的。**(只有姓和名都一样才算重名)**Output
分数:200分
部分
问题描述
有N个人。第i个人(1≤i≤N)的姓氏和名字分别为S_i和T_i。
判断是否存在一对人拥有相同的姓氏和名字。换句话说,判断是否存在一对整数(i,j),满足1≤i<j≤N,S_i=S_j和T_i=T_j。
部分
约束
* 2≤N≤1000
* N为整数。
* 每个S_i和T_i都是由小写英文字母组成的长度在1到10(含)之间的字符串。
部分
输入
输入按照以下格式从标准输入给出:
N
S_1 T_1
S_2 T_2
……
S_N T_N
部分
输出
如果存在一对人拥有相同的姓氏和名字,输出Yes;否则,输出No。
部分
样例输入1
3
tanaka taro
sato hanako
tanaka taro
部分
样例输出1
Yes
第一个人和第三个人拥有相同的姓氏和名字。
部分
样例输入2
3
saito ichiro
saito jiro
saito saburo
部分
样例输出2
No
没有两个人拥有相同的姓氏和名字。
部分
样例输入3
4
sypdgidop bkseq
bajsqz hh
ozjekw mcybmtt
qfeysvw dbo
部分
样例输出3
No