#include #include using namespace std; bool grid[100000] = {0}; size_t result[100001] = {0}; size_t fall_times[100000] = {0}; size_t rows, cols, tp_count; int main() { cin.tie(NULL); std::ios::sync_with_stdio(false); string line; cin >> rows >> cols >> tp_count; getline(cin, line); for (int i = 0; i < rows; i++) { getline(cin, line); for (int j = 0; j < cols; j++) { grid[i*cols + j] = line[j] == '*'; } } for (int col = cols - 1; col >= 0; col--) { fall_times[(rows-1) * cols + col] = 0; } size_t max_time = 0; for (int row = rows - 2; row >= 0; row--) { for (int col = cols - 1; col >= 0; col--) { if (grid[(row+1) * cols + col]) { fall_times[row * cols + col] = fall_times[(row+1) * cols + col]; } else { fall_times[row * cols + col] = fall_times[(row+1) * cols + col] + 1; if (fall_times[row * cols + col] > max_time) { max_time = fall_times[row * cols + col]; } } if (grid[row * cols + col]) { result[fall_times[row * cols + col]]++; } } } result[0] = 0; for (int i = 0; i < rows*cols; i++) { if (grid[i] && fall_times[i] == 0) { result[0]++; } } for (int i = 1; i <= max_time; i++) { result[i] += result[i-1]; } size_t tstep = 0; for (int i = 0; i < tp_count; i++) { cin >> tstep; if (tstep > max_time) { tstep = max_time; } cout << result[tstep] << '\n'; } return 0; }