Classic Puzzle Medium
Tags: Graphs, Interactive Loop
Cut links in a graph to prevent an AI to reach a destination.
For each test you are given:
- A map of the network.
- The position of the exit gateways.
- The starting position of the Skynet agent.
- Nodes can only be connected to up to a single gateway.
Each game turn:
- First off, you sever one of the given links in the network.
- Then the Skynet agent moves from one Node to another accessible Node.
The Skynet agent cannot reach an exit gateway
The Skynet agent has reached a gateway
- Line 1: 3 integers
N
L
E
N
, the total number of nodes in the level, including the gateways.L
, the number of links in the level.E
, the number of exit gateways in the level.
- Next
L
lines: 2 integers per line (N1
,N2
), indicating a link between the nodes indexedN1
andN2
in the network. - Next
E
lines: 1 integerEI
representing the index of a gateway node.
- Line 1: 1 integer
SI
, which is the index of the node on which the Skynet agent is positioned this turn.
- A single line comprised of two integers
C1
andC2
separated by a space.C1
andC2
are the indices of the nodes you wish to sever the link between.
- 2 ≤
N
≤ 500 - 1 ≤
L
≤ 1000 - 1 ≤
E
≤ 20 - 0 ≤
N1
,N2
<N
- 0 ≤
SI
<N
- 0 ≤
C1
,C2
<N
- Response time per turn ≤ 150ms
4 4 1
0 1
0 2
1 3
2 3
3
Loop Input
0
Response
1 3
Loop Input
2
Response
2 3
Success!
Kotlin: SkynetRevolution.kt (SkynetRevolutionTest.kt)
https://www.codingame.com/ide/puzzle/skynet-revolution-episode-1