1 条题解

题解与来源题共享。已有题解默认通过;新增或编辑后需由来源域管理员审核。待审核、驳回题解仅作者和审核管理员可见。来源域:system

  • 0
    @ 2026-8-30 17:23:51

    核心思路:记录下4个点的坐标,不断一起向下平移,由于4个点是一个整体,其中一个点碰到边界则停止循环,得到最终答案

    import sys
    input = sys.stdin.readline
    
    a = [[0]*11 for _ in range(16)]
    
    for i in range(1,16):
        row = list(map(int,input().split()))
        for j in range(1,11):
            a[i][j] = row[j-1]
    
    tp = []
    for i in range(1,5):
        row = list(map(int,input().split()))
        for j in range(1,5):
            if row[j-1] == 1:
                tp.append((i,j))
    
    bias = int(input())
    tp = [(x, y+bias-1) for x,y in tp]
    
    while True:
        nxt = [(x+1,y) for x,y in tp]
    
        if any(x>15 or a[x][y] for x,y in nxt):
            for x,y in tp:
                a[x][y] = 1
            break
    
        tp = nxt
    
    for i in range(1,16):
        print(*a[i][1:11])
    
    • 1

    信息

    ID
    548
    时间
    1000ms
    内存
    256MiB
    难度
    普及−
    标签
    递交数
    235
    已通过
    37
    上传者