{"problem":{"name":"014. Labyrinth","description":{"content":"You find yourself stuck in a labyrinth and don't know your way out! There are several dangerous traps placed throughout the labyrinth. You need to find a way out, but first you need to know how many t","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269014"},"statements":[{"statement_type":"Markdown","content":"You find yourself stuck in a labyrinth and don't know your way out! There are several dangerous traps placed throughout the labyrinth. You need to find a way out, but first you need to know how many traps there are in the labyrinth.\n\nYou will be 2D grid with dimensions _n_ by _m_. _x_ denotes a trap, and _._ denotes no trap. The first line of input will contain two space-separated integers _n_ and _m_, representing the dimensions of the grid. The next _n_ lines will each contain _m_ characters representing a row of the labyrinth.\n\nOutput a single integer _t_: the total number of traps in the labyrinth.\n\nHint: use a 2D array!\n\n## Input\n\nYou will be 2D grid with dimensions _n_ by _m_. _x_ denotes a trap, and _._ denotes no trap. The first line of input will contain two space-separated integers _n_ and _m_, representing the dimensions of the grid. The next _n_ lines will each contain _m_ characters representing a row of the labyrinth.\n\n## Output\n\nOutput a single integer _t_: the total number of traps in the labyrinth.\n\n[samples]\n\n## Note\n\nHint: use a 2D array!","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ denote the dimensions of a 2D grid.  \nLet $ G \\in \\{ \\text{`x'}, \\text{`.'} \\}^{n \\times m} $ be the grid representation, where `x` denotes a trap and `.` denotes no trap.\n\n**Constraints**  \n1. $ n \\geq 1 $, $ m \\geq 1 $  \n2. Each cell $ G[i][j] \\in \\{ \\text{`x'}, \\text{`.'} \\} $ for $ i \\in \\{1, \\dots, n\\} $, $ j \\in \\{1, \\dots, m\\} $\n\n**Objective**  \nCompute the total number of traps:  \n$$ t = \\sum_{i=1}^{n} \\sum_{j=1}^{m} \\mathbb{I}[G[i][j] = \\text{`x'}] $$  \nwhere $ \\mathbb{I}[\\cdot] $ is the indicator function.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269014","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}