這邊是它的test data 幫你們打好了哦,(✪ω✪)記得感謝我(大誤)
6 6
######
##.#.#
#..#.#
#.##.#
#.#..#
######
4
2 3
5 4
2 5
5 2
----------->>> 1 3 6 10
5 5
.....
.....
.....
.....
.....
3
3 3
3 3
3 3
----------->>> 1 5 13
4 5
..#..
.#.#.
..#..
.....
2
2 3
2 3
----------->>> 1 1
3 2
..
..
..
3
1 1
3 2
1 1
----------->>> 1 4 6
下面有psuedo code 小心踩雷
大概的想法就是把今天的boundary更新成明天的boundary
-----process start-----
create bool matrix obstacle[h + 2][w + 2], pollution[h + 2][w + 2]
create coordinate list boundary, new boundary
int count = 0
for each day
____if today is not inside the boundary:
________boundary.append(today)
________count++
____printf(count)
____for b in boundary:
________if up, down left, right is not obstacle and has no pollution:
____________change pollution up, down, left, right to true
____________count++
-----process end-----
這邊是它的test data 幫你們打好了哦,(✪ω✪)記得感謝我(大誤)
6 6
######
##.#.#
#..#.#
#.##.#
#.#..#
######
4
2 3
5 4
2 5
5 2
----------->>> 1 3 6 10
5 5
.....
.....
.....
.....
.....
3
3 3
3 3
3 3
----------->>> 1 5 13
4 5
..#..
.#.#.
..#..
.....
2
2 3
2 3
----------->>> 1 1
3 2
..
..
..
3
1 1
3 2
1 1----------->>> 1 4 6
下面有psuedo code 小心踩雷
大概的想法就是把今天的boundary更新成明天的boundary
-----process start-----
create bool matrix obstacle[h + 2][w + 2], pollution[h + 2][w + 2]
create coordinate list boundary, new boundary
int count = 0
for each day
____if today is not inside the boundary:
________boundary.append(today)
________count++
____printf(count)
____for b in boundary:
________if up, down left, right is not obstacle and has no pollution:
____________change pollution up, down, left, right to true
____________count++
-----process end-----
阿忘記說了,推薦搞題++