100 atcoder#ABC190C. [ABC190C] Bowls and Dishes
[ABC190C] Bowls and Dishes
Score : points
Problem Statement
We have dishes numbered and conditions numbered . Condition is satisfied when both Dish and Dish have (one or more) balls on them. There are people numbered . Person will put a ball on Dish or Dish . At most how many conditions will be satisfied?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 4
1 2
1 3
2 4
3 4
3
1 2
1 3
2 3
2
For example, if People put their balls on Dishes , respectively, Conditions and will be satisfied.
4 4
1 2
1 3
2 4
3 4
4
3 4
1 2
2 4
2 4
4
For example, if People put their balls on Dishes , respectively, all conditions will be satisfied.
6 12
2 3
4 6
1 2
4 5
2 6
1 5
4 5
1 3
1 2
2 6
2 3
2 5
5
3 5
1 4
2 6
4 6
5 6
9