QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263742#5101. Crystal CrosswindjuampiRE 0ms0kbPython31.6kb2023-11-25 05:31:142023-11-25 05:31:14

Judging History

你现在查看的是最新测评结果

  • [2023-11-25 05:31:14]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-11-25 05:31:14]
  • 提交

answer

PY, PX = map(int, input().split())
while True:
    try:
        g = [0] * PX
        cg = [[0] * PX for _ in range(101)]

        for y in range(PY):
            row = list(map(int, input().split()))
            for x in range(PX):
                PC = row[x]
                if PC != 0:
                    g[PX - 1 - x] |= 1 << (PY - 1 - y)
                    cg[PC][PX - 1 - x] |= 1 << (PY - 1 - y)

        for v in cg:
            for b in v:
                b = ~b

        QY, QX = map(int, input().split())
        fail = [0] * QX
        gg = [[0] * PX for _ in range(101)]
        cookie = [[-1] * PX for _ in range(101)]

        for y in range(QY):
            row = list(map(int, input().split()))
            for x in range(QX):
                QC = row[x]
                for px in range(max((PX - 1) - x, 0), PX):
                    fx = x - (PX - 1) + px
                    if fx > QX - PX:
                        break
                    if cookie[QC][px] != y:
                        cookie[QC][px] = y
                        if y < PY:
                            gg[QC][px] = (g[px] & cg[QC][px]) >> (PY - 1 - y)
                        else:
                            gg[QC][px] = (g[px] & cg[QC][px]) << (y - (PY - 1))
                    fail[x - (PX - 1) + px] |= gg[QC][px]

        result = []
        for y in range(QY - PY + 1):
            for x in range(QX - PX + 1):
                if not fail[x][y]:
                    result.append((x, y))

        print(len(result))
        for x, y in result:
            print(y + 1, x + 1)

    except EOFError:
        break

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

4 1 1
0 1 2 1 1 3 1

output:


result: