AtCoder Regular Contest 205 (Div. 2)
B
Triangle Toggle
AtCoder
⌀ 1361
原题
← AC →
翻译中…

Problem Statement

翻译中…

There is a complete graph with $N$ vertices numbered $1$ to $N$. Each edge is colored black or white. For $i=1,2,\ldots,M$, the edge connecting vertices $U_i$ and $V_i$ is colored black, and all other edges are colored white.

翻译中…

You can perform the following operation zero or more times.

翻译中…
  • Choose a triple of integers $(a,b,c)$ satisfying $1\le a < b < c \le N$, and repaint each of the following three edges: white to black, black to white.
  • The edge connecting vertices $a$ and $b$
    • The edge connecting vertices $b$ and $c$
    • The edge connecting vertices $a$ and $c$
翻译中…

Find the maximum number of edges that can be colored black when you perform operations appropriately.

翻译中…

Constraints

翻译中…
  • $3\le N\le 2\times 10^5$
  • $\displaystyle 0\le M\le 2\times 10^5$
  • $1\le U_i < V_i \le N$
  • $(U_i , V_i) \neq (U_j , V_j)$ $(i \neq j)$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N M
U_1 V_1
U_2 V_2
\vdots
U_M V_M

翻译中…

Output

翻译中…

Output the answer.

翻译中…

样例

Input #1
4 1
1 2
Output #1
5
By performing two operations as follows, you can make the number of black edges $5$. - Choose $(a,b,c)=(1,3,4)$. Then, we have the following four black edges. - The edge connecting vertices $1$ and $2$ - The edge connecting vertices $1$ and $3$ - The edge connecting vertices $1$ and $4$ - The edge connecting vertices $3$ and $4$ - Choose $(a,b,c)=(2,3,4)$. Then, we have the following five black edges. - The edge connecting vertices $1$ and $2$ - The edge connecting vertices $1$ and $3$ - The edge connecting vertices $1$ and $4$ - The edge connecting vertices $2$ and $3$ - The edge connecting vertices $2$ and $4$ You cannot make the number of black edges more than $5$, so output $5$.
Input #2
7 3
1 2
2 3
3 6
Output #2
20
Input #3
123123 0
Output #3
7579575003
Be careful about overflow.
题目信息
题号
arc205_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。