4981. It takes two

单点时限: 1.0 sec

内存限制: 256 MB

lbrominewanted to play It Takes Two, but it takes two. So he went to his friends and asked them if they had played It Takes Two.

It is known thatlbrominehas $n$ friends. When he asks a friend, the friend will only answer that he has not played or played It Takes Two with another person.Because some of his friends are forgetful,maybe some friends have played It Takes Two but say no.

lbrominethinks that a friend has played It Takes Two only when the friend said he had played with another person or another friend oflbrominesaid he had played with him.

Nowlbrominewants to count how many friends he thinks have never played It Takes Two so that he can choose the right person to play with.


An integer $n$ in the first line indicates thatlbrominehas $n\ (1 \leq n\leq 10^5)$ friends.

The next $n$ line has two strings per line. The first string represents the friend’s name, and the second string represents the answer of the friend.

It is guaranteed that the answer oflbromine'sfriends can only be No or a person’s name (may not be a friend oflbromine).

A person’s name only contains uppercase and lowercase letters and underscores,and the length cannot exceed $10$ characters.

no one names No.


One integer indicates how many friendslbrominethinks have never played It Takes Two


CN_Amuzi No
komorebi MaverickFW
MaverickFW No

620 人解决,842 人已尝试。

699 份提交通过,共有 2575 份提交。

2.1 EMB 奖励。

创建: 2 月,1 周前.

修改: 2 月前.

最后提交: 7 小时前.

来源: 2023 年上海市大学生程序设计竞赛 - 一月赛