#877
Platinum III
STAZA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

A bicycle race is being organized in a country. The transport network of the country consists of N cities numbered 1 through N, with M bidirectional roads connecting them. We will use the following terms:

  • A path is a sequence of roads in which each road starts in the city the preceding road ended in.

  • A simple path is a path which never visits a city more than once.

  • A ring is a simple path ending in the same city it started in.

The network is such that there is at least one path between every pair of cities. Additionally, every road in the network is part of at most one ring. Your task is to find the longest path for the race satisfying two constraints:

  • The path may begin in any city, but must end in city 1.

  • The path may visit a city more than once, but it must not contain any road more than once.

입력

The first line of input contains two integers N and M (2 ≤ N ≤ 10 000, 1 ≤ M ≤ 2N-2) – the numbers of cities and roads in the network. Each of the following M lines contains two different integers A and B (1 ≤ A, B ≤ N). These numbers indicate that there is a bidirectional road between cities A and B. No two cities will be directly connected by more than one road.

출력

Output the length of the longest race path on a single line.

예제 입력 1

4 3
1 2
1 3
2 4

예제 출력 1

2

예제 입력 2

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

예제 출력 2

5

예제 입력 3

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

예제 출력 3

6
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Platinum III1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.