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

J. Joint Excavation

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

The mole family recently decided to dig a new tunnel network. The layout, which has already been decided, consists of chambers and bidirectional tunnels connecting them, forming a connected graph. Mother mole wants to use the opportunity to teach her two mole kids how to dig a tunnel network.

As an initial quick demonstration, mother mole is going to start by digging out a few of the chambers and tunnels, in the form of a non-self-intersecting path in the planned tunnel network. She will then divide the remaining chambers between the two mole kids, making sure that each mole kid has to dig out the same number of chambers, or else one of the mole kids will become sad. (The tunnels are much easier to dig out, and thus of no concern.) The kids may work on their assigned chambers in any order they like.

Since the mole kids do not have much experience with digging tunnel networks, mother mole realises one issue with her plan: if there is a tunnel between a pair of chambers that are assigned to different mole kids, there is a risk of an accident during the excavation of that tunnel if the other mole kid happens to be digging in the connecting chamber at the same time.

Help mother mole decide which path to use for her initial demonstration, and how to divide the remaining chambers evenly, so that no tunnel connects a pair of chambers assigned to different mole kids. The initial path must consist of at least one chamber and must not visit a chamber more than once.

제약
입력 형식

The input consists of:
- One line with two integers \(c\) and \(t\) (\(1 \leq c \leq 2 \cdot 10^5\), \(0 \leq t \leq 2 \cdot 10^5\)), the number of chambers and tunnels in the planned tunnel network.
- \(t\) lines, each containing two integers \(a\) and \(b\) (\(1 \leq a,b \leq c\), \(a \neq b\)), describing a bidirectional tunnel between chambers \(a\) and \(b\).

The chambers are numbered from \(1\) to \(c\). There is at most one tunnel between any pair of chambers, and there exists a path in the network between any pair of chambers.

출력 형식

First output two integers \(p\) and \(s\), the number of chambers on the path in mother mole's initial demonstration and the number of chambers each mole kid has to dig out. Then output a line containing the \(p\) chambers in mother mole's initial path, in the order that she digs them out. Then output two more lines, each containing the \(s\) chambers that the respective mole kid has to dig out, in any order.

The input is chosen such that there exists at least one valid solution. If there are multiple valid solutions, you may output any one of them.

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

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

출처 ICPC NWERC 2020

평가 및 의견

J. Joint Excavation

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Joint Excavation

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