CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:pinger80
Submission time:2020-10-07 03:55:17 +0300
Language:Python3 (CPython3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.03 s1, 2, 3details
#20.03 s1, 2, 3details
#30.03 s1, 2, 3details
#40.03 s1, 2, 3details
#50.03 s1, 2, 3details
#60.03 s1, 2, 3details
#70.03 s1, 2, 3details
#80.03 s2, 3details
#90.03 s2, 3details
#100.03 s2, 3details
#110.03 s3details
#120.03 s3details
#130.03 s3details

Code

n = int(input())

taulukko = [[999 for y in range(n)] for x in range(n)]
taulukko[0][0] = 0
x, y = 0, 0
# moves = 1,2 . 2,1 . -1,-2 . -2,-1 . -1, 2 . -2, 1 . 1, -2 . 2, -1.

def askel(x,y):

    global taulukko
    global n
    taulukko[x][y] = min(taulukko[x][y],taulukko[min(n-1,x+1)][min(n-1,y+2)],taulukko[min(n-1,x+2)][min(n-1,y+1)],taulukko[max(0,x-1)][max(0,y-2)],taulukko[max(0,x-2)][max(0,y-1)],taulukko[max(0,x-1)][min(n-1,y+2)],taulukko[max(0,x-2)][min(n-1,y+1)],taulukko[min(n-1,x+1)][max(0,y-2)],taulukko[min(n-1,x+2)][max(0,y-1)])+1
    
    askel(min(n-1,x+1), min(n-1,y+2))
    askel(min(n-1,x+2), min(n-1,y+1))
    askel(max(0,x-1), max(0,y-2))
    askel(max(0,x-2), max(0,y-1))
    askel(max(0,x-1), min(n-1,y+2))
    askel(max(0,x-2), min(n-1,y+1))
    askel(min(n-1,x+1), max(0,y-2))
    askel(min(n-1,x+2), max(0,y-1))

    if 999 not in taulukko:     
        return None

askel(x,y)

for x in taulukko:
    print(*x, sep = " ")

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
4

correct output
0 3 2 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 2

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 3

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 4

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 5

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 6

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 7

Group: 1, 2, 3

Verdict:

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 8

Group: 2, 3

Verdict:

input
25

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 9

Group: 2, 3

Verdict:

input
49

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 10

Group: 2, 3

Verdict:

input
50

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 11

Group: 3

Verdict:

input
75

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 12

Group: 3

Verdict:

input
99

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...

Test 13

Group: 3

Verdict:

input
100

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 26, in <module>
    askel(...