#include #include using namespace std; /*void prlongPole( long sizeX, long sizeY,bool playground[][]) { for (long y = 0; y < sizeY; y++) { for (long x = 0; x < sizeX; x++) { if(playground[x][y]) cout << '*'; else cout << '.'; } cout << "\n"; } }*/ int main() { long sizeX, sizeY; long timeCount; string temp; long countFlakes = 0; cin >> sizeX; cin >> sizeY; cin >> timeCount; long tCounts[timeCount] = {0}; bool playground[sizeX][sizeY] = {0}; for (long x = 0; x < sizeX; x++) { temp = {0}; cin >> temp; //cout << temp << "\n"; for (long y = 0; y < sizeY; y++) { if(temp[y] == '*') {playground[x][y] = true; }else playground[x][y] = false; } } for(long i = 0; i < timeCount; i++) { cin >> tCounts[i]; } for (long k = 0; k <= tCounts[timeCount-1]; k++) { //check countFlakes = 0; for (long y = sizeY-1; y >= 0; y--) { for (long x = sizeX-1; x >= 0; x--) { if(playground[x][y]) { countFlakes++; } else break; } } for (long m = 0; m < timeCount; m++) { if(tCounts[m] == k) { cout << countFlakes << "\n"; } } //posun for (long x = sizeX-1; x >= 0; x--) { for (long y = sizeY-1; y >= 0; y--) { if(playground[x][y] && (x != sizeX-1 && playground[x+1][y] != true)) { //goes down playground[x][y] = false; playground[x+1][y] = true; } } } } return 0; }