QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#348. 斑斓星

الإحصائيات

三道题名字取自专辑 Girls POP Vol.2 的一首歌的标题,这一系列专辑都超好听~


天上有 $n$ 颗星星,人们为了标识出星座,给这 $n$ 颗星星之间画上了 $m$ 条链接。定义一个星座是一个星星构成的非空集合,一个星座的密集度是找出其中一颗星星,与星座内其他星星相连的链接数最小,该星座的密集度就是这颗星星在星座内其他星星相连的链接数。

请你找出一个星座,其密集度最大。

输入格式

第一行两个正整数 $n, m$ 分别表示星星和链接数量。

接下来 $m$ 行,每行两个正整数 $u, v$,表示星星 $u$ 和星星 $v$ 之间有一条链接。

保证两颗星星之间最多一条链接,每条链接勾连不同的两颗星星。

输出格式

输出一个正整数,表示密集度最大的星座的密集度。

样例数据

样例 1 输入

8 13
1 2
1 3
1 4
1 5
1 6
2 3
2 4
2 7
3 5
3 7
4 5
4 8
5 6

样例 1 输出

3

样例 1 解释

星座的样子如图:

problem_348_1.png

保留星星 $1, 2, 3, 4, 5$ 可以达到最大的密集度。

数据范围

对于 $100\%$ 的数据,$n, m \le10^5$。

测试点 $n$ $m$
$1,2$ $\le 3$ $\le3$
$3,4,5$ $\le3$ $\le10^2$
$6,7$ $\le18$ $\le10^3$
$8$ $\le10^3$ $\le10^5$
$9,10$ $\le10^5$ $\le10^5$

故事

阿斯卡特兰,我还是喜欢直接叫她,兰。

小时候的兰就非常可爱,尤其是在她看星星的时候。她的眼眸是酒红色的,会令任何人沉醉其中。

今天晚上,我们再次一起坐在屋顶上。我拿着星图带她认识一个个星座。“我为什么没有在天上看到这些竖线呢?”“啊,那是我们为了更好地记住每个星座的样子,在星图上画的。”

“嘿嘿,我最喜欢这个星座了,可惜它现在看起来不太明显呢。”“是啊,我们也并不总是能看到这星图上的那些星星呢……”

这时,我注意到她开始出神地凝视那个星座在星空中的方向。是我的错觉吗?好像这个星座的星星逐渐变得明亮起来,而其他星星立刻显得黯然失色。

她转过头,冲我笑嘻嘻地说,“嘿嘿,那你给我讲讲这个星座的故事呗。”

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.