QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263718 | #5101. Crystal Crosswind | juampi | RE | 0ms | 0kb | Python3 | 1.4kb | 2023-11-25 04:38:17 | 2023-11-25 04:38:18 |
answer
import sys
def doit(x, y):
ch = g[y][x] if (x >= 1 and x <= X and y >= 1 and y <= Y) else '.'
if not ch:
return
for i in range(N):
x2 = x + (wm[i] if ch == '.' else -wm[i])
y2 = y + (wn[i] if ch == '.' else -wn[i])
if (x2 >= 1 and x2 <= X and y2 >= 1 and y2 <= Y and not g[y2][x2]):
g[y2][x2] = ch
doit(x2, y2)
while True:
line = sys.stdin.readline().strip()
if not line:
break
X, Y, N = map(int, line.split())
g = [['.' for _ in range(X+1)] for _ in range(Y+1)]
wm = [0] * N
wn = [0] * N
for i in range(N):
wm[i], wn[i], B = map(int, sys.stdin.readline().split())
for _ in range(B):
x, y = map(int, sys.stdin.readline().split())
g[y][x] = '#'
x2 = x - wm[i]
y2 = y - wn[i]
if (x2 >= 1 and x2 <= X and y2 >= 1 and y2 <= Y):
g[y2][x2] = '.'
for y in range(-Y, 2*Y+1):
for x in range(-X, 2*X+1):
doit(x, y)
for y in range(1, Y+1):
for x in range(1, X+1):
sys.stdout.write(g[y][x] if g[y][x] else '.')
sys.stdout.write('\n')
sys.stdout.write('\n')
for y in range(1, Y+1):
for x in range(1, X+1):
sys.stdout.write(g[y][x] if g[y][x] else '#')
sys.stdout.write('\n')
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