QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#734235 | #9714. A Colorful Grid | riad_alarefi | WA | 15ms | 10512kb | Python3 | 1.9kb | 2024-11-11 07:28:20 | 2024-11-11 07:28:23 |
Judging History
answer
def solve():
import sys
input = sys.stdin.read
data = input().split()
index = 0
T = int(data[index])
index += 1
results = []
for t in range(T):
n = int(data[index])
m = int(data[index + 1])
k = int(data[index + 2])
index += 3
conditions = []
for _ in range(k):
x1 = int(data[index])
y1 = int(data[index + 1])
x2 = int(data[index + 2])
y2 = int(data[index + 3])
c = int(data[index + 4])
conditions.append((x1, y1, x2, y2, c))
index += 5
grid = [['L' for _ in range(m)] for _ in range(n)]
possible = True
for (x1, y1, x2, y2, c) in conditions:
if (x2, y2) == (x1, y1 + 1):
if c == 0:
if grid[x1-1][y1-1] == 'L':
grid[x1-1][y1-1] = 'R'
elif grid[x1-1][y1-1] == 'R':
possible = False
else:
if grid[x1-1][y1-1] == 'L':
grid[x1-1][y1-1] = 'R'
grid[x2-1][y2-1] = 'L'
elif (x2, y2) == (x1 + 1, y1):
if c == 0:
if grid[x1-1][y1-1] == 'L':
grid[x1-1][y1-1] = 'D'
elif grid[x1-1][y1-1] == 'D':
possible = False
else:
if grid[x1-1][y1-1] == 'L':
grid[x1-1][y1-1] = 'D'
grid[x2-1][y2-1] = 'U'
if possible:
results.append(f"Case #{t + 1}: Yes")
for row in grid:
results.append(''.join(row))
else:
results.append(f"Case #{t + 1}: No")
print('\n'.join(results))
詳細信息
Test #1:
score: 0
Wrong Answer
time: 15ms
memory: 10512kb
input:
4 2 2 1 1 1 1 2 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 2 1 2 2 2 1 1 1 2 0 1 1 2 1 0
output:
result:
wrong output format Unexpected end of file - token expected