题解 | #小红炸砖块#
小红炸砖块
https://www.nowcoder.com/practice/2715e18a82a548c7b00c94a348df0b84
n, m, k = map(int, input().split()) t = [tuple(map(int, input().split())) for _ in range(k)] # Initialize the grid with '*' res = [['*'] * m for _ in range(n)] # Record the next available row in each column next_available_row = [0] * m # Process each bomb for x, y in t: j = y - 1 i = next_available_row[j] if i < x: # Ensure we don't go out of bounds res[i][j] = '.' next_available_row[j] += 1 # Print the resulting grid for r in res: print(''.join(r))