Submission #1205974

#TimeUsernameProblemLanguageResultExecution timeMemory
1205974AzeTurk810Tracks in the Snow (BOI13_tracks)C++20
Compilation error
0 ms0 KiB
There is a rectangular meadow in a forest, having been covered with a blanket of fresh snow in the morning (left in the figure below). Rabbits and foxes, who live in the forest, are crossing the meadow and leave their tracks in the snow. They always enter in the upper left corner and leave the meadow from the lower right corner. In between they can move back and forth, playing in the snow, even crossing their own tracks. At any time there is at most one animal on the meadow. No animal enters the meadow more than once. The movements of the animals can be described by dividing the meadow into quadratic cells. The animals never move diagonally in a single step and they never jump over a cell. When an animal enters a cell its tracks will cover all previous tracks left in this cell. For example, first a rabbit crossed the meadow from top-left to bottom-right (middle in the figure). After that, a fox crossed, and now his tracks are partially covering the rabbit’s (right in the figure). ........ RRR..... FFR..... ........ ..RRR... .FRRR... ........ ..R..... .FFFFF.. ........ ..RRRR.R ..RRRFFR ........ .....RRR .....FFF You are given a map of the meadow at some time after indicating for each cell if there are any visible tracks and whether they were left by a rabbit or by a fox (right in the figure). You are interested in the local wildlife population. Write a program to determine the minimal possible number N of animals that must have crossed the meadow to leave the given pattern of tracks in the snow. Input The first line contains two integers H and W , the height and the width of the map of the meadow. H lines follow with exactly W characters on each: the map, where ‘.’ marks untouched snow, ‘R’ a spot where a rabbit’s track is the topmost one, and ‘F’ a spot where a fox’s track is the topmost one. There is at least one track on the meadow. Output The output should consist of a single integer: the minimal number N ≥ 1 of animals that could have left the tracks given in the input. Constraints 1 ≤ H, W ≤ 4000 In test cases worth 30 points: N ≤ 200 and H, W ≤ 500

Compilation message (stderr)

tracks.cpp:11:74: error: extended character ’ is not valid in an identifier
   11 | After that, a fox crossed, and now his tracks are partially covering the rabbit’s (right in the figure).
      |                                                                          ^
tracks.cpp:23:64: error: extended character ‘ is not valid in an identifier
   23 | lines follow with exactly W characters on each: the map, where ‘.’ marks untouched snow, ‘R’ a spot
      |                                                                ^
tracks.cpp:23:66: error: extended character ’ is not valid in an identifier
   23 | lines follow with exactly W characters on each: the map, where ‘.’ marks untouched snow, ‘R’ a spot
      |                                                                  ^
tracks.cpp:23:90: error: extended character ‘ is not valid in an identifier
   23 | lines follow with exactly W characters on each: the map, where ‘.’ marks untouched snow, ‘R’ a spot
      |                                                                                          ^
tracks.cpp:23:90: error: extended character ’ is not valid in an identifier
tracks.cpp:24:9: error: extended character ’ is not valid in an identifier
   24 | where a rabbit’s track is the topmost one, and ‘F’ a spot where a fox’s track is the topmost one. There
      |         ^
tracks.cpp:24:48: error: extended character ‘ is not valid in an identifier
   24 | where a rabbit’s track is the topmost one, and ‘F’ a spot where a fox’s track is the topmost one. There
      |                                                ^
tracks.cpp:24:48: error: extended character ’ is not valid in an identifier
tracks.cpp:24:67: error: extended character ’ is not valid in an identifier
   24 | where a rabbit’s track is the topmost one, and ‘F’ a spot where a fox’s track is the topmost one. There
      |                                                                   ^
tracks.cpp:27:69: error: extended character ≥ is not valid in an identifier
   27 | The output should consist of a single integer: the minimal number N ≥ 1 of animals that could have
      |                                                                     ^
tracks.cpp:30:3: error: extended character ≤ is not valid in an identifier
   30 | 1 ≤ H, W ≤ 4000
      |   ^
tracks.cpp:30:10: error: extended character ≤ is not valid in an identifier
   30 | 1 ≤ H, W ≤ 4000
      |          ^
tracks.cpp:31:34: error: extended character ≤ is not valid in an identifier
   31 | In test cases worth 30 points: N ≤ 200 and H, W ≤ 500
      |                                  ^
tracks.cpp:31:49: error: extended character ≤ is not valid in an identifier
   31 | In test cases worth 30 points: N ≤ 200 and H, W ≤ 500
      |                                                 ^
tracks.cpp:1:1: error: 'There' does not name a type
    1 | There is a rectangular meadow in a forest, having been covered with a blanket of fresh snow in the
      | ^~~~~