#P8907. [USACO22DEC] Making Friends P
[USACO22DEC] Making Friends P
Description
Among FJ's cows numbered , there are initially pairs of friends. The cows leave the farm one by one to go on vacation. On day , cow leaves the farm, and at the same time, all of cow 's friends that are still on the farm become friends with each other. How many new friendship relationships are created in total?
Input Format
The first line contains and .
The next lines each contain two integers and , meaning cows and are friends (). Each unordered pair of cows appears at most once.
Output Format
Output one line containing the total number of new friendship relationships formed. Do not count pairs of cows that were already friends initially.
7 6
1 3
1 4
7 1
2 3
2 4
3 5
5
Hint
Explanation for Sample 1
On day , three new friendship relationships are created: , , and .
On day , two new friendship relationships are created: and .
Test Point Properties
- Test points satisfy .
- Test points satisfy .
- Test points have no additional constraints.
Translated by ChatGPT 5
京公网安备 11011102002149号