Friendship Editing
시간 제한2초메모리 제한2048 MB
정점이 16개 이하인 그래프가 주어질 때, 모든 간선의 두 끝점이 나머지 정점을 지배하도록 만드는 최소 간선 추가/삭제 횟수를 구한다.
문제
Farmer John's cows are labeled to (). The friendship relationships between the cows can be modeled as an undirected graph with () edges. Two cows are friends if and only if there is an edge between them in the graph.
In one operation, you can add or remove a single edge from the graph. Count the minimum number of operations required to ensure that the following property holds: If cows and are friends, then for every other cow , at least one of and is friends with .
입력
The first line contains and .
The next lines each contain a pair of friends and (). No pair of friends appears more than once.
출력
The number of edges you need to add or remove.