#include #include #include using namespace std; int n,m,kolku; int dr[1005] = {-1, 0, +1, 0}; int dc[1005] = {0, +1, 0, -1}; int vis[1005][1005]; int s[10]; int cnt[20]; char mat[1005][1005]; //koj polinja gi ima koj vo sekoj moment queueQ[20]; int main() { ios_base::sync_with_stdio(false); cin>>n>>m>>kolku; for(int i=0;i>s[i]; } for(int i=0;i>mat[i][j]; vis[i][j]=false; } } for(int i=0;i>v; while(!Q[i].empty()) { int r=Q[i].front(); Q[i].pop(); int c=Q[i].front(); Q[i].pop(); int d=Q[i].front(); Q[i].pop(); // cout << i + 1 << " " << r + 1 << " " << c + 1 << " " << d <=0 && nc=0 && vis[nr][nc]==false && mat[nr][nc]=='.' && d - 1 >= 0) { Q[i].push(nr); Q[i].push(nc); Q[i].push(d-1); v.push_back({nr,nc}); vis[nr][nc]=true; cnt[i]++; } } } for(int j=0;j