100 atcoder#ABC147C. [ABC147C] HonestOrUnkind2
[ABC147C] HonestOrUnkind2
Score : points
Problem Statement
There are people numbered to . Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.
Person gives testimonies. The -th testimony by Person is represented by two integers and . If , the testimony says Person is honest; if , it says Person is unkind.
How many honest persons can be among those people at most?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible number of honest persons among the people.
3
1
2 1
1
1 1
1
2 0
2
If Person and Person are honest and Person is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.
3
2
2 1
3 0
2
3 1
1 0
2
1 1
2 0
0
Assuming that one or more of them are honest immediately leads to a contradiction.
2
1
2 0
1
1 0
1