RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00294

Sumo

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(4^{th}\) round, January \(18^{th}\), 2014

In a Japanese monastery, otherwise known for serious fasting and ascetic life, the Head of the sumo
wrestling section has decided to organise traini\(ng-co\)mpetitions for his N fighters. He determined the
exact sequence of M fights and its participants (two fighters face each other per fight).

Just moments before the competition, the Head realised he could easily stir things up a bit! He could
divide his fighters into two teams so that only fighters of different teams face each other in each fight.
Since the fighting schedule has already been made and it doesn't meet this condition, and we mustn't
change it for whatever zen reason there is, the Head is left with only one option. That is to divide the
fighters into two teams so that the fighters from the same team face each other in a fight as late as
possible.

Help the Head! For a given fighting schedule, determine the ordinal number of the first fight where
two fighters from the same team have to face each other, under the condition that we divide them in
the best possible way, so that the required fight takes place as late as possible. In all test data, such fight
will definitely occur.

제약
입력 형식

The first line of input contains the integer N (\(1 \le N \le 100\,000\)), the number of fighters. The fighters
are marked with numbers from 1 to N.
The second line of input contains the integer M (\(1 \le M \le 300\,000\)), the number of fights.
Each of the following M lines contains fights in the order which they must take place. Each line
contains two different integers from the interval [1, N]: the labels of fighters who are going to face each
other.

출력 형식

The first and only line of output must contain the ordinal number (from 1 to M) of the required fight.

\(4^{th}\) round, January \(18^{th}\), 2014

예제 1
입력
5
5
1 2
2 3
3 4
4 5
5 1
출력
5
예제 2
입력
6
8
1 2
3 4
5 6
1 3
1 6
4 5
2 4
2 6
출력
6
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2013/2014 Contest 4

평가 및 의견

Sumo

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Sumo

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8