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

32547번 - Kitchens of Königsberg 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 1024 MB356413.793%

문제

The year is 1764ドル$ (or 900ドル$ in base-14ドル$). During the past few decades, the bridges of Königsberg have become a major attraction for combinatorics tourism from all over the world. In a recent travel brochure, your predecessor on the Königsberg Board of Tourism has promised the existence of $k$ Bridges Alongside Palatable Cuisine, where hungry graph theorists can combine their intellectual and culinary pursuits by finishing their pilgrimage with a delicious bowl of traditional meatballs from a charming street kitchen. Alas, none of these kitchens have actually been built, so this will be your first task!

Naturally, you begin by modelling Königsberg as an undirected multigraph. Rivers divide the city into areas, which you model as vertices, and the bridges become the edges. With this abstraction, you start to investigate whether it is possible to select areas to place kitchens in, so that exactly $k$ bridges end in an area with a kitchen. As an example, consider the first sample case, shown in Figure K.1.

Figure K.1: Visualization of the first sample case. If kitchens are placed at areas $A$ and $B,ドル then the 6ドル$ bridges $a,ドル $b,ドル $c,ドル $d,ドル $e,ドル and $f$ are serviced. Another solution would be to place kitchens at $B$ and $C$.

Modified from Solutio problematis ad geometriam situs pertinentis by Leonhard Euler

입력

The input consists of:

  • One line with three integers $n,ドル $m,ドル and $k$ (1ドル \leq n \leq 5000,ドル 0ドル \leq m \leq 50,000円,ドル 1ドル \leq k \leq 6$), the number of areas, the number of bridges, and the number of bridges that must end in an area with a kitchen.
  • $m$ lines, each with two integers $a$ and $b$ (1ドル \leq a < b \leq n$), indicating a bridge between areas $a$ and $b$. Note that there can be multiple bridges between the same pair of areas.

출력

If there is a subset of areas in which kitchens can be placed, so that exactly $k$ bridges end in an area with a kitchen, output the number of areas in this subset, followed by these areas. Otherwise, output "impossible".

If there are multiple valid solutions, you may output any one of them.

제한

예제 입력 1

4 7 6
1 2
1 2
1 3
1 3
1 4
2 4
3 4

예제 출력 1

2
1 2

예제 입력 2

7 9 5
1 2
2 3
1 3
1 4
4 5
1 5
1 6
6 7
1 7

예제 출력 2

3
4 2 3

예제 입력 3

8 7 6
1 2
1 3
1 4
1 5
1 6
1 7
1 8

예제 출력 3

6
8 7 6 4 3 2

예제 입력 4

5000 0 1

예제 출력 4

impossible

예제 입력 5

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

예제 출력 5

impossible

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 Preliminaries K번

  • 문제를 만든 사람: Tobias Roehr
(追記) (追記ここまで)

출처

대학교 대회

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

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