题目链接:
题意:
十滴水游戏,具体细节见http://www.4399.com/flash/6356_2.htm
给出所有已固定大水滴 的位置和大小
问在(x,y)处发生爆裂 的T秒后,所有已固定水滴的状态
解题思路:
大水滴会分裂,每一秒保存所有正在飞溅的小水滴(x,y,dir),每个小水滴有三种情况
1 如果飞溅的小水滴碰到了大水滴,则消失,大水滴+1
2 到了一个空的位置,保存至下一秒的 容器
3 出界 消失
同时记录当前秒要爆炸的大水滴,模拟分裂,将分裂的小水滴保存至下一秒的容器
当所有水滴静止,或经过T秒即可得出所有答案
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#define maxn 105
using namespace std;
struct node{
int x,y,d;
int state;
}ans[maxn],head,t;
int dir[4][2]={1,0,0,1,-1,0,0,-1};
int map[maxn][maxn];
int id[max