B
B
BitNeBolt2021-06-23 20:42:31
Algorithms
BitNeBolt, 2021-06-23 20:42:31

What test does the solution fail?

I solve this problem, but I can't pass the 11th test. I checked the solution in many cases: when the exit is achievable, when it is shorter to get to it through the portal, when without a portal, when there is a path through several consecutive portals, when the portal leads to a zone in which the exit is located, but which cannot be reached due to walls.

There should be no overflow, since I have already started using BiInteger (I write in Java).

What other option is worth checking out?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2021-06-23
@BitNeBolt

The simplest task on bfs. Without code, it's hard to tell where it's messed up.
There can be no overflow, you don't need bigInteger. Even long is not needed: the maximum path length is 10000.

R
Rsa97, 2021-06-23
@Rsa97

The task is reduced to building a graph and finding the shortest path in it.
Each compartment that does not have a wall is a graph node.
Each possible transition between compartments, both to adjacent compartments and through a hypertunnel, is an edge of the graph.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question