358 teams scored 35480 points on this task, for a maximum score of 100, an average score of 99 and a median score of 100.
Carlo decided to quit his studies and start a software company. He decided to locate the headquarters of his new company in a remote city in the mountains. Among all the cities he visited, he found the perfect one: a city with a rectangular shape and a lake in the middle. That is, the city can be represented by a grid of N × M square cells, where each cell is either land (represented by `.') or water (represented by `#'). Carlo needs inspiration to develop his software, so every morning he goes for a walk around the lake, enjoying the beautiful surroundings. One morning, however, he could not concentrate, and a question nagged at him: how long is the perimeter of the lake? Unfortunately, none of his software could answer this question, so he asks for your help!