图问题 2026AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There is a simple undirected graph with $N$ vertices and $M$ edges.
The vertices are numbered $1$ through $N$ and the edges are numbered $1$ through $M$; edge $i$ connects vertices $u_i$ and $v_i$.
Assign a non-negative integer weight $W_j$ not greater than $2026$ to each vertex $j$ so that the following condition is satisfied:
有一个包含 $N$ 个顶点和 $M$ 条边的简单无向图。
顶点编号为 $1$ 至 $N$,边编号为 $1$ 至 $M$;第 $i$ 条边连接顶点 $u_i$ 和 $v_i$。
请为每个顶点 $j$ 分配一个不超过 $2026$ 的非负整数权重 $W_j$,使得满足以下条件:AI (CI翻译)
$W_{u_i}+W_{v_i} \leq 2026$for each edge$i$.
- 对于每条边
$i$,均有$W_{u_i}+W_{v_i} \leq 2026$。
Find the maximum possible value of the sum of all vertex weights (that is, $\sum_{j=1}^{N}{W_j}$).
求所有顶点权重之和(即 $\sum_{j=1}^{N}{W_j}$)的最大可能值。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 \leq N \leq 5 \times 10^4$$0 \leq M \leq 5 \times 10^4$$1 \leq u_i \lt v_i \leq N$$(u_1,v_1),(u_2,v_2),\dots,(u_M,v_M)$are pairwise distinct.- All input values are integers.
$1 \leq N \leq 5 \times 10^4$$0 \leq M \leq 5 \times 10^4$$1 \leq u_i \lt v_i \leq N$$(u_1,v_1),(u_2,v_2),\dots,(u_M,v_M)$两两不同。- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入中按以下格式给出:AI (CI翻译)
N M
u_1 v_1
u_2 v_2
\vdots
u_M v_M
N M
u_1 v_1
u_2 v_2
\vdots
u_M v_MAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answer on a single line.
在一行中输出答案。AI (CI翻译)
样例
3 2
1 2
2 3
4052
4 6
1 2
2 3
1 4
2 4
1 3
3 4
4052
2 1
1 2
2026
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。