Logo
(追記) (追記ここまで)

29938번 - Delivery robots 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB211100.000%

문제

Juku likes hot dogs. A lot.

Juku lives in a town that has $V$ intersections and $E$ two-way streets connecting the intersections. Intersections have been numbered 1ドル \ldots V$. No pair of intersections is connected by more than one street and no street connects an intersection to itself. From every intersection it is possible to get to every other intersection along the streets. Also, there is a hot dog stand on every intersection.

Juku has started building delivery bots that would bring hot dogs to him. He wants to choose two intersections---initial location of robots $s$ and his own location $f$---and code robots such that he could get hot dogs from as many different stands as possible.

Unfortunately, programming the robots is rather limited. Every robot can store an array $n$ and a variable $b$ in memory. Robot starts moving from intersection $s$ and repeats the following steps:

  1. If robot is located at intersection $b,ドル it will buy a hot dog from the stand there.
  2. If robot is located at intersection $f,ドル it will give the hot dog to Juku and stop.
  3. Robot moves to intersection $n[i]$ where $i$ is its current location.

For every $i \in 1 \ldots V$ there must be a street between intersections $i$ and $n[i],ドル otherwise the robot will crash.

Find the maximum number of different stands that Juku can get hot dogs from if he chooses $s$ and $f$ optimally and enters $n$ and $b$ into robots optimally as well. The values $s$ and $f$ are the same for all robots, but $n$ and $b$ can be different for every robot. You may assume that Juku can use arbitrarily many robots.

입력

First line of input contains two integers $V$ and $E$---numbers of intersections and streets (1ドル \le V \le 10^5,ドル 1ドル \le E \le 3 \cdot 10^5$). On the next $E$ lines there are two integers $u$ and $v$ on each, indicating a street between intersections $u$ and $v$.

출력

The output should contain a single integer---the maximum number of different stands that Juku can get hot dogs from.

제한

예제 입력 1

6 6
1 2
2 3
3 1
4 1
5 2
6 3

예제 출력 1

5

The maximum number of stands is 5. For this we can pick for example $s = 4,ドル $f = 5$ and code the robots in the following way:

$b$ $n[1]$ $n[2]$ $n[3]$ $n[4]$ $n[5]$ $n[6]$
1 3 5 2 1 2 3
2 2 5 6 1 2 3
3 3 5 2 1 2 3
4 2 5 1 1 2 3
5 2 5 2 1 2 3

힌트

출처

Olympiad > Estonian Informatics Olympiad > 2018-19 > Open Competition 5번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /