CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:tassu
Submission time:2020-09-28 13:31:42 +0300
Language: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

size = 20 # int(input())
matrix = [[999999]*size for i in range(size)]
matrix[0][0] = 0

def check_point(point):
    return point[0] >= 0 and point[0] < size and point[1] >= 0 and point[1] < size

def get_possibilities_for_point(x, y):
    global size
    return filter(check_point, [
        (x-2, y-1),
        (x-2, y+1),
        (x+2, y-1),
        (x+2, y+1),
        (x-1, y-2),
        (x-1, y+2),
        (x+1, y-2),
        (x+1, y+2),
    ])

def kay_lapi(x, y, count=1):
    global size
    if count > (size * 0.75):
        return
    for point in get_possibilities_for_point(x, y):
        if matrix[point[0]][point[1]] <= count:
            continue
        matrix[point[0]][point[1]] = count
        kay_lapi(point[0], point[1], count+1)


kay_lapi(0, 0)

for row in matrix:
    print(' '.join(str(x) for x in row))

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

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
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...