QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 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

星座的樣子如圖:

保留星星 $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$

故事

阿斯卡特蘭,我還是喜歡直接叫她,蘭。

小時候的蘭就非常可愛,尤其是在她看星星的時候。她的眼眸是酒紅色的,會令任何人沉醉其中。

今天晚上,我們再次一起坐在屋頂上。我拿著星圖帶她認識一個個星座。「我為什麼沒有在天上看到這些豎線呢?」「啊,那是我們為了更好地記住每個星座的樣子,在星圖上畫的。」

「嘿嘿,我最喜歡這個星座了,可惜它現在看起來不太明顯呢。」「是啊,我們也並不總是能看到這星圖上的那些星星呢……」

這時,我注意到她開始出神地凝視那個星座在星空中的方向。是我的錯覺嗎?好像這個星座的星星逐漸變得明亮起來,而其他星星立刻顯得黯然失色。

她轉過頭,衝我笑嘻嘻地說,「嘿嘿,那你給我講講這個星座的故事唄。」

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.