Task: | Ruudukko |
Sender: | tkok |
Submission time: | 2025-09-27 13:41:56 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.06 s | details |
Code
t = int(input()) def ratko(n: int, m: int) -> list[list[int]]: tulos = [list() for x in range(m)] c = 1 for i in range(n): for j in range(m): tulos[j].append(c) c += 1 for x in range(m): if x % 2 == 1: tulos[x] = tulos[x][-1:] + tulos[x][0:-1] return tulos swappi = False while t > 0: t -= 1 n, m = [int(x) for x in input().split()] if n > m: swappi = True n, m = m, n if (n, m) in {(1, 2), (1, 3), (2, 2)}: print("NO") continue print("YES") # yhden rivin speciaali if n == 1: lista = [str(v) for v in list(range(2, m + 1, 2)) + list(range(1, m + 1, 2))] if swappi: for x in lista: print(x) else: print(" ".join(lista)) continue tulos = ratko(n, m) if not swappi: for x in range(n): rivi = "" for y in range(m): rivi += str(tulos[y][x]) + " " print(rivi.strip()) else: for y in range(m): rivi = "" for x in range(n): rivi += str(tulos[y][x]) + " " print(rivi.strip())
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
100 1 1 1 2 2 1 1 3 ... |
correct output |
---|
YES 1 NO NO NO ... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 3, in <module> def ratko(n: int, m: int) -> list[list[int]]: TypeError: 'type' object is not subscriptable (key <class 'int'>)