106. Geiger Counter

Codeforces
IDCF10269106
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Geiger Counter You're in a large maze, and unfortunately the maze is filled with differing amounts of uranium ore, which could potentially expose you to dangerous amounts of radioactivity. Luckily, you have brought your trusty Geiger Counter with you, so you can measure the radioactivity of any given part of the maze in counts per minute (CPM). You start at the top left corner of the maze, and you are trying to travel to the bottom of the maze. For any path through the maze, its _radioactivity value_ is defined as the maximum CPM across all cell in the maze that you travel through on the path. Your task is to find the path through the maze with the lowest radioactivity value, in other words, find the highest CPM you have to expose yourself to if you travel on the optimal path. You're allowed to move in any direction (except diagonally), and you can visit the same cell twice (although it is never necessary to). Note that since the constraints on the size of the maze are fairly large, a brute force (complete search) solution that tries all possible paths,will not work. The first line of input contains two space-separated positive integers $n$ and $m$: the number of rows and columns in the maze, respectively. $n$ and $m$ will be less than 100. The next $n$ lines each contain a string containing $m$ digits (between 0 and 9), representing the radioactivity of each space in the maze in CPM. Output a single positive integer: the maximum amount of radioactivity that you have to expose yourself to, if you travel optimally through the maze and minimize this value. If you aren't sure where to start, try thinking of the maze as a graph. Also, you should add these two lines to the top of your code if you're going to use recursion in your solution and you're coding in Python: _import sys_ _sys.setrecursionlimit(20000)_ ## Input The first line of input contains two space-separated positive integers $n$ and $m$: the number of rows and columns in the maze, respectively. $n$ and $m$ will be less than 100. The next $n$ lines each contain a string containing $m$ digits (between 0 and 9), representing the radioactivity of each space in the maze in CPM. ## Output Output a single positive integer: the maximum amount of radioactivity that you have to expose yourself to, if you travel optimally through the maze and minimize this value. [samples] ## Note If you aren't sure where to start, try thinking of the maze as a graph.Also, you should add these two lines to the top of your code if you're going to use recursion in your solution and you're coding in Python:_import sys__sys.setrecursionlimit(20000)_
**Definitions** Let $ n, m \in \mathbb{Z}^+ $ denote the number of rows and columns of the maze, with $ n, m < 100 $. Let $ G = (V, E) $ be a grid graph where each cell $ (i, j) $, for $ 0 \le i < n $, $ 0 \le j < m $, is a vertex, and edges connect horizontally and vertically adjacent cells. Let $ c(i, j) \in \{0, 1, \dots, 9\} $ be the radioactivity (CPM) at cell $ (i, j) $, given as a digit in the input string. **Constraints** 1. Start at $ (0, 0) $. 2. End at any cell in row $ n-1 $ (i.e., bottom row). 3. Movement allowed: up, down, left, right (no diagonals). 4. Cells may be revisited (but optimal path will not require it). 5. Path must be connected and finite. **Objective** Find the path $ P $ from $ (0, 0) $ to some $ (n-1, j) $, $ 0 \le j < m $, that minimizes: $$ \max_{(i,j) \in P} c(i, j) $$ Output the minimal possible value of this maximum.
API Response (JSON)
{
  "problem": {
    "name": "106. Geiger Counter",
    "description": {
      "content": "Geiger Counter You're in a large maze, and unfortunately the maze is filled with differing amounts of uranium ore, which could potentially expose you to dangerous amounts of radioactivity. Luckily, y",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269106"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Geiger Counter\n\nYou're in a large maze, and unfortunately the maze is filled with differing amounts of uranium ore, which could potentially expose you to dangerous amounts of radioactivity. Luckily, y...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ denote the number of rows and columns of the maze, with $ n, m < 100 $.  \nLet $ G = (V, E) $ be a grid graph where each cell $ (i, j) $, for $ 0 \\le i <...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments