QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263742 | #5101. Crystal Crosswind | juampi | RE | 0ms | 0kb | Python3 | 1.6kb | 2023-11-25 05:31:14 | 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