| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 8 초 | 1024 MB | 35 | 6 | 4 | 13.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:
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.
4 7 6 1 2 1 2 1 3 1 3 1 4 2 4 3 4
2 1 2
7 9 5 1 2 2 3 1 3 1 4 4 5 1 5 1 6 6 7 1 7
3 4 2 3
8 7 6 1 2 1 3 1 4 1 5 1 6 1 7 1 8
6 8 7 6 4 3 2
5000 0 1
impossible
4 6 2 1 2 1 3 1 4 2 3 2 4 3 4
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 Preliminaries K번