luogu#P9850. [ICPC2021 Nanjing R] Ancient Magic Circle in Teyvat
[ICPC2021 Nanjing R] Ancient Magic Circle in Teyvat
题目描述
Astrologist Mona Megistus discovers an ancient magic circle in Teyvat recently.
The magic circle looks like a complete graph with vertices, where edges are colored red and other edges are colored blue. Note that a complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge.
Mona realizes that if she chooses four different vertices such that the six edges between these four vertices are of the same color, she will get a key from the magic circle. If the color is red, she will get a red key, and if the color is blue, she will get a blue key.
Base on the information written in the ancient books Mona has read, the magic power of the ancient magic circle is the absolute difference between the number of red keys and the number of the number of blue keys she can get from the magic circle.
Mona needs your help badly, since calculating the magic power of the magic circle is really a tough job.
输入格式
There is only one test case in each test file.
The first line of the input contains two integers and (, ) indicating the number of vertices and the number of edges colored red of the ancient magic circle.
For the following lines, the -th line contains two integers and () indicating a red edge connecting vertices and . It is guaranteed that each edge appears at most once.
输出格式
Output one line containing one integer indicating the magic power of the ancient magic circle.
题目大意
给定一个 个点的完全图,有 条边是红色的,其余边是蓝色的,求出边均为蓝色的大小为 的完全子图个数与边均为红色的大小为 的完全子图个数的差。
,。
7 6
1 2
1 3
1 4
2 3
2 4
3 4
3
提示
For the sample case, there is only one red key and there are four blue keys , , and in the ancient magic circle, thus the magic power of the magic circle is .