QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 64 MB 満点: 100

#12686. 办公室

統計

Bytel 是一家移动通信巨头。每位员工都配有一部公司手机,手机内存中存储着部分同事的电话号码(所有这些同事的手机中也存有该员工的号码)。由于业务的快速增长,董事会打算将公司总部搬迁至新的办公楼。为了提高工作效率,董事会决定:每一对在不同办公楼工作的员工都必须(相互)知道对方的电话号码,即他们的公司手机内存中必须存有对方的号码。

同时,董事会决定租用尽可能多的办公楼,以确保良好的工作条件。请帮助 Bytel 董事会根据上述要求规划办公楼的数量及其规模。

编写一个程序:

  • 从标准输入读取员工电话号码列表的描述
  • 计算满足董事会条件的办公楼的最大数量及其规模
  • 将结果写入标准输出

输入格式

标准输入的第一行包含两个整数 $n$ 和 $m$($2 \le n \le 100\,000$,$1 \le m \le 2\,000\,000$),用空格分隔,分别表示 Bytel 的员工人数以及手机内存中存有对方号码的员工对数。员工编号从 $1$ 到 $n$。

接下来的 $m$ 行,每行包含一对整数 $a_i$ 和 $b_i$($1 \le a_i < b_i \le n$,对于 $1 \le i \le m$),用空格分隔,表示员工 $a_i$ 和 $b_i$ 的手机内存中(相互)存有对方的号码。输入中每对员工编号最多出现一次。

输出格式

第一行应包含一个整数:Bytel 应租用的办公楼的最大数量。第二行应包含一个非递减的正整数序列,用空格分隔,表示各办公楼的规模(即在其中工作的员工人数)。如果存在多个正确答案,输出其中任意一个即可。

样例

输入 1

7 16
1 3
1 4
1 5
2 3
3 4
4 5
4 7
4 6
5 6
6 7
2 4
2 7
2 5
3 5
3 7
1 7

输出 1

3
1 2 4

说明

一种示例性的员工办公楼分配方案:4 号员工在第一栋办公楼,5 号和 7 号员工在第二栋办公楼,1 号、2 号、3 号和 6 号员工在第三栋办公楼。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.