http://codeforces.com/problemset/problem/1105/D
The meaning of the title: There is a matrix area. At the beginning, there are multiple forces such as 1, 2, 3, 4….9, starting from the force 1 and expanding outwards in turn, the map is’.’ which can be occupied, and’#’ cannot be occupied. After being occupied, you can’t be occupied by others again, you can only expand up, down, left, and right. Each force has an expansion speed. Find how many grids each force occupies in the entire area.
Problem solving:
1. Obviously bfs, but the speed varies greatly, and multi-directional bfs
2. The input data may have more than one starting point of the same force (pit)
3. Starting from force 1 to expand in turn, not the queue to the end at once
#include
#include
#include
#include
#include
#include<string>
#include
#include
#include
#include
#include
#include
#include<string>
#include