题解 | #小红炸砖块#

小红炸砖块

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))

全部评论

相关推荐

无敌战神大菜鸡:计算机来卷嵌入式?疯啦
点赞 评论 收藏
分享
提醒喝水小助手:简历太乱了,哪有简历能写三页的啊,先把间距缩小一点,然后项目建议分行写,时间题目职责一行,然后每个技术点一行,重点加粗,看起来也比这样直接一段话好看
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务