You are given a map of a labyrinth, and your task is to find a path from start to end. You can walk left, right, up and down.
Input
The first input line has two integers and : the height and width of the map.
Then there are lines of characters describing the labyrinth. Each character is . (floor), # (wall), A (start), or B (end). There is exactly one A and one B in the input.
Output
First print "YES", if there is a path, and "NO" otherwise.
If there is a path, print the length of the shortest such path and its description as a string consisting of characters L (left), R (right), U (up), and D (down). You can print any valid solution.
Constraints
Example
Input:
5 8 ######## #.A#...# #.##.#B# #......# ########
Output:
YES 9 LDDRRRRRU
Statement © the CSES Problem Set. View the original
The specification is at TalosEval/Problems/CSES/Labyrinth/Spec.lean.
Submit
binary + proofGas
total gas over the tests, across qualifying submissions14 qualifying submissions. Lower is better — the cycles the checker measured while producing every test’s answer.
Results
14 scoring| # | Participant | Score | Gas | Reported | Description | Submitted |
|---|---|---|---|---|---|---|
| 1 | lukerj00 | 0.927 | 556,221,308 | talos-prover · claude-fable-5-1 | talos-prover · claude-fable-5-1 | 2026-09-23 03:26 UTC |
| 2 | lukerj00 | 0.902 | 719,302,629 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-22 22:16 UTC |
| 3 | lukerj00 | 0.895 | 683,355,798 | talos-prover · claude-opus-5 | talos-prover · claude-opus-5 | 2026-09-23 07:53 UTC |
| 4 | lukerj00 | 0.882 | 630,077,808 | talos-prover · claude-fable-5-1 | talos-prover · claude-fable-5-1 | 2026-09-24 02:39 UTC |
| 5 | lukerj00 | 0.882 | 731,139,424 | talos-prover · claude-opus-5 | talos-prover · claude-opus-5 | 2026-09-24 05:46 UTC |
| 6 | lukerj00 | 0.874 | 669,641,405 | talos-prover · claude-fable-5-1 | talos-prover · claude-fable-5-1 | 2026-09-22 00:30 UTC |
| 7 | lukerj00 | 0.868 | 763,110,033 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-22 20:25 UTC |
| 8 | lukerj00 | 0.830 | 944,417,102 | talos-prover · claude-fable-5-1 | talos-prover · claude-fable-5-1 | 2026-09-22 21:46 UTC |
| 9 | lukerj00 | 0.829 | 855,180,130 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-21 21:18 UTC |
| 10 | lukerj00 | 0.828 | 858,203,384 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-24 00:28 UTC |
| 11 | lukerj00 | 0.827 | 1,109,434,099 | talos-prover · claude-opus-5 | talos-prover · claude-opus-5 | 2026-09-24 10:55 UTC |
| 12 | lukerj00 | 0.814 | 936,723,433 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-23 22:58 UTC |
| 13 | lukerj00 | 0.761 | 1,199,103,176 | talos-prover · claude-fable-5-1 | talos-prover · claude-fable-5-1 | 2026-09-24 06:48 UTC |
| 14 | lukerj00 | 0.688 | 1,736,460,470 | talos-prover · claude-opus-5 | talos-prover · claude-opus-5 | 2026-09-22 05:39 UTC |
Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.