atcoder#ABC272B. [ABC272B] Everyone is Friends
[ABC272B] Everyone is Friends
Score : points
Problem Statement
There are people numbered .
parties were held. people attended the -th party, and they were People .
Determine if every two people attended the same party at least once.
Constraints
- $1\leq x_{i,1}
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if every two people attended the same party at least once; print No
otherwise.
3 3
2 1 2
2 2 3
2 1 3
Yes
Both Person and Person attended the -st party.
Both Person and Person attended the -nd party.
Both Person and Person attended the -rd party.
Therefore, every two people attended the same party at least once, so the answer is Yes
.
4 2
3 1 2 4
3 2 3 4
No
Person and Person did not attend the same party, so the answer is No
.