| Task: | Ratsun reitit |
| Sender: | siar |
| Submission time: | 2020-10-03 13:14:50 +0300 |
| Language: | Python3 (CPython3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| #2 | RUNTIME ERROR | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #2 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #3 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #4 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #5 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #6 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #7 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details |
| #8 | RUNTIME ERROR | 0.02 s | 2, 3 | details |
| #9 | RUNTIME ERROR | 0.02 s | 2, 3 | details |
| #10 | RUNTIME ERROR | 0.03 s | 2, 3 | details |
| #11 | RUNTIME ERROR | 0.02 s | 3 | details |
| #12 | RUNTIME ERROR | 0.03 s | 3 | details |
| #13 | RUNTIME ERROR | 0.03 s | 3 | details |
Code
ruudukonKoko = int(input(""))
hevonenAloitus = [1, 1]
#mihinHevosenHalutaan = [4, 3]
class cell:
def __init__(self, x=0, y=0, dist=0):
self.x = x
self.y = y
self.dist = dist
#dist "pituus countteri"
def onkoRuudunSisällä(x, y, ruudukonKoko):
if (x >= 1 and x <= ruudukonKoko and y >= 1 and y <= ruudukonKoko):
return True
return False
def lyhyinReittiMihinHevostaHalutaan(hevonenAloitus, mihinHevosenHalutaan, ruudukonKoko):
hevonenX = [2, 2, -2, -2, 1, 1, -1, -1]
hevonenY = [1, -1, 1, -1, 2, -2, 2, -2]
queue = []
queue.append(cell(hevonenAloitus[0], hevonenAloitus[1], 0))
#queue.append(cell)
vierailtu = [[False for i in range(ruudukonKoko + 1)] for j in range(ruudukonKoko + 1)]
vierailtu[hevonenAloitus[0]][hevonenAloitus[1]] = True
while (len(queue) > 0):
i = queue[0]
queue.pop(0)
#print(i.x, " iii-x")
if (i.x == mihinHevosenHalutaan[0] and i.y == mihinHevosenHalutaan[1]):
return i.dist
for i in range(8):
x = i.x + hevonenX[i]
y = i.y + hevonenY[i]
#for x in hevo
if (onkoRuudunSisällä(x, y, ruudukonKoko) and not vierailtu[x][y]):
vierailtu[x][y] = True
#print(vierailtu[1][2])
queue.append(cell(x, y, i.dist + 1))
for ySivu in range(1, ruudukonKoko+1):
for xSivu in range(1, ruudukonKoko+1):
print(lyhyinReittiMihinHevostaHalutaan(hevonenAloitus, [ySivu, xSivu], ruudukonKoko), end = ' ')
print("")
#print(lyhyinReittiMihinHevostaHalutaan(hevonenAloitus, mihinHevosenHalutaan, ruudukonKoko))Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 4 |
| correct output |
|---|
| 0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 2
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 5 |
| correct output |
|---|
| 0 3 2 3 2 3 4 1 2 3 2 1 4 3 2 3 2 3 2 3 2 3 2 3 4 |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 3
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 6 |
| correct output |
|---|
| 0 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 3 2 3 2 3 4 2 3 2 3 4 3 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 4
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 7 |
| correct output |
|---|
| 0 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 3 2 3 2 3 4 3 2 3 2 3 4 3 4 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 5
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 8 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 3 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 6
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 9 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 3 4 1 2 3 4 3 4 5 2 1 4 3 2 3 4 5 4 3 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 5 4 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 7
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 3 4 1 2 3 4 3 4 5 6 2 1 4 3 2 3 4 5 4 5 3 2 3 2 3 4 3 4 5 6 2 3 2 3 4 3 4 5 4 5 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 8
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 25 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 9
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 49 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 10
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 50 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 11
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 75 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 12
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 99 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...Test 13
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
print(...