Pachinko
Time limit6sMemory limit512 MB
A ball wanders a grid with random moves and absorbing targets, and each target needs its hit probability from a uniform top-row start.
- Level
Hard8 of 10
- Topics
- Probability, Graph, Matrix
- Solved
- No attempts yet
Problem
A Pachinko grid uses open cells (.), obstacles (X), and targets (T).
A ball launches uniformly into one open cell on the top row. From an open cell it bounces up, down, left, or right with given percentage probabilities that sum to 100. If a bounce hits an obstacle or leaves the grid, the ball stays put. A target absorbs the ball.
For each target T, output the probability that a launched ball hits it. List targets from top to bottom, breaking ties left to right. Absolute error at most .
Input
- Line 1: , (, ).
- Line 2: , , , summing to 100.
- Next lines: the grid. Top row has at least one
.and noT.
Output
One probability per target, one line each.