Memory allocation problem of the program, like want to add a certain number of water drops in the po
no vote
//Topic meaning: there are n pools, and the current number of water drops in each pool is given to you. Once the number of water drops in the pool is greater than 4, the pool will explode, / / and it will be divided into four water drops and set out in four directions. There are only two situations for water drops: one is to walk out of the map, the other is to touch the pool, and now you are given an explosion point, / / this point will emit water drops in four directions, and ask you all the information in T seconds Point state, water drops move one lattice in one second / / idea: use BFS to simulate the state of each water drop, because the time is 10000, and there are 100 pools, then the worst complexity is 4000000, / / it should be no problem, and the data should be very water, and run faster. Let's talk about the method. For each time point, let's enumerate all the data in the current queue There are / / water drops. If the water drop touches the pool, it stops. If it doesn't touch it, it continues to walk, one grid per second. Then if it reaches the pool, the number of water drops in the pool will be increased by 1 / / if it is greater than 4, the pool will be divided into four water drops and added to the queue until the end of time