시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 23 | 13 | 13 | 56.522% |
The mechanical Turk was an 18th-century sham robot designed to give the illusion of artificial intelligence by playing chess. More importantly, the Turk inspired us to make our own fake robot that gives the illusion of real intelligence by solving programming contest problems.
We put some gears on axles inside an uncovered panel to make our machine look more realistic. Since the gears are just for visual effect, they have been placed so as to create an impressive meshing pattern; however, the placement is without any regard to gear ratios or turning direction, so it is possible that none of the gears can really move.
It is guaranteed that every axle was connected to every other axle by meshing, either directly or indirectly. Two axles a and b are said to have directly meshing gears if their distance from one another is equal to the sum of the radii of their gears (dab = rga + rgb).
Sadly, the gears fell off our machine. We think we collected all of them back up again, but now we are not sure which should go back on which axle. Please find a way of putting the gears on the axles to make them mesh the way they did originally.
The input consists of:
If the machine can be fixed with the given gears, give any one valid matching by outputting n integers g1. . .gn, where gi is the 1-based index of the gear to put on the i-th axle. Otherwise, output “impossible”.
4 20 10 5 15 4 1 2 15 2 3 30 3 4 35 1 4 20
3 2 1 4
6 10 55 80 5 60 50 6 2 4 60 3 4 65 4 5 90 1 6 65 5 6 85 1 4 70
5 6 2 1 3 4
4 1 2 1 1 4 1 4 3 2 4 3 3 4 3 1 3 2
3 1 4 2
3 3 4 5 2 1 2 7 1 3 7
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2017 PB번
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2020 PB번