Submission details
Task:Hypyt
Sender:Emerald0X2
Submission time:2025-11-06 10:56:20 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#10.07 s1, 2, 3, 4, 5details
#20.07 s1, 2, 3, 4, 5details
#30.07 s1, 2, 3, 4, 5details
#40.07 s1, 2, 3, 4, 5details
#50.07 s1, 2, 3, 4, 5details
#60.17 s2, 5details
#70.15 s2, 5details
#80.13 s2, 5details
#90.10 s3, 4, 5details
#100.09 s3, 4, 5details
#110.09 s3, 4, 5details
#120.11 s4, 5details
#130.10 s4, 5details
#140.10 s4, 5details
#150.17 s5details
#160.15 s5details
#170.13 s5details
#180.12 s5details
#190.10 s5details
#200.11 s5details
#210.09 s5details
#220.07 s1, 2, 3, 4, 5details
#230.07 s1, 2, 3, 4, 5details
#240.07 s5details
#250.07 s5details
#260.20 s5details
#270.63 s5details

Code

y, x, questions = input().split()
 
y = int(y)
x = int(x)
questions = int(questions)

x_pos = {}
y_pos = {}
safe = {}

for i in range(y):
    row = input()
    row_points = []
    for j in range(len(row)):
        row_points.append((i,j))
        if row[j] == ".":
            safe.update({(i,j): 0})
            if(x_pos.get(j, None) == None):
                x_pos.update({j: [i]})
            else:
                x_pos[j].append(i)

            if(y_pos.get(i, None) == None):
                y_pos.update({i: [j]})
            else:
                y_pos[i].append(j)

print(x_pos, y_pos)
print(safe)

for q in range(questions):
    y1,x1,y2,x2 = input().split()
    y1 = int(y1)-1
    x1 = int(x1)-1
    y2 = int(y2)-1
    x2 = int(x2)-1
 
    start = (y1,x1)
    end = (y2,x2)
 
    current = [start]
 
    seen_y = {y1}
    seen_x = {x1}
 
    could_jump = False
 
    jumps = 1

    for key in safe:
        safe[key] = abs(key[0]-y2)+abs(key[1]-x2)

    if start != end:
        while end not in current:
            visible_points = {}
            for pos in safe:
                if (pos[0] == current[len(current)-1] or pos[1] == current[len(current)-1]) and pos not in current:
                    visible_points.update({pos: safe[pos]})
                    could_jump = True

            closest = min(visible_points, key=visible_points.get)

            current.append(closest)
            seen_y.add(closest[0])
            seen_x.add(closest[1])



            if not could_jump:
                jumps = -1
                break
    else:
        jumps = 0

    print(jumps)
 

Test details

Test 1 (public)

Group: 1, 2, 3, 4, 5

Verdict:

input
4 6 5
.*.***
*...**
*****.
*..*.*
...

correct output
1
0
3
3
-1

user output
{0: [0], 2: [0, 1, 3], 1: [1, ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 2

Group: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
..........
.....*....
........*.
*.*....*..
...

correct output
1
2
1
2
2
...

user output
{0: [0, 1, 2, 4, 5, 6, 7, 8, 9...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 3

Group: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
*...***.**
*****.*...
**..**.**.
..**.**.*.
...

correct output
1
2
2
1
2
...

user output
{1: [0, 3, 4, 5, 6, 8], 2: [0,...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 4

Group: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
***.*.****
**********
*.********
.*.***.**.
...

correct output
3
4
2
3
4
...

user output
{3: [0, 7], 5: [0, 5, 8], 1: [...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 5

Group: 1, 2, 3, 4, 5

Verdict:

input
10 10 1
.****.****
**.**..***
**********
*******..*
...

correct output
7

user output
{0: [0, 5], 5: [0, 1, 8], 2: [...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 6

Group: 2, 5

Verdict:

input
250 250 250
.*...*.....*******..**...*.......

correct output
2
3
3
2
2
...

user output
{0: [0, 1, 2, 3, 5, 6, 8, 9, 1...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 7

Group: 2, 5

Verdict:

input
250 250 250
...*......**.**.*.*..**..*..**...

correct output
2
2
2
2
3
...

user output
{0: [0, 2, 3, 4, 8, 9, 11, 12,...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 8

Group: 2, 5

Verdict:

input
250 250 250
**..**..****.****.*.***.***..*...

correct output
2
3
3
3
3
...

user output
{2: [0, 4, 18, 22, 25, 26, 27,...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 9

Group: 3, 4, 5

Verdict:

input
40 40 200000
...*.**.*..*.............*.*.....

correct output
2
2
2
2
2
...

user output
{0: [0, 2, 3, 4, 5, 6, 7, 8, 9...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 10

Group: 3, 4, 5

Verdict:

input
40 40 200000
**.**..*.*.*.******....****.*....

correct output
2
1
3
2
2
...

user output
{2: [0, 1, 3, 6, 8, 14, 16, 18...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 11

Group: 3, 4, 5

Verdict:

input
40 40 200000
.*.*.**.*****.***.*.****.**.**...

correct output
3
3
3
3
3
...

user output
{0: [0, 4, 11, 18, 19, 36, 38]...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 12

Group: 4, 5

Verdict:

input
80 80 200000
*....**.***..****...*.....*......

correct output
2
2
2
2
2
...

user output
{1: [0, 1, 2, 4, 5, 6, 7, 10, ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 13

Group: 4, 5

Verdict:

input
80 80 200000
.***.*..*.***..*****....**...*...

correct output
3
2
2
3
2
...

user output
{0: [0, 1, 2, 5, 7, 8, 17, 19,...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 14

Group: 4, 5

Verdict:

input
80 80 200000
*******.*****.*..*..****...***...

correct output
2
3
1
2
2
...

user output
{7: [0, 3, 6, 7, 9, 10, 12, 13...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 15

Group: 5

Verdict:

input
250 250 200000
*....*..*..*..**..*.........**...

correct output
3
2
2
2
2
...

user output
{1: [0, 2, 4, 5, 6, 8, 9, 10, ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 16

Group: 5

Verdict:

input
250 250 200000
..*....*..*......*.**.*.*..***...

correct output
2
2
2
2
2
...

user output
{0: [0, 1, 3, 4, 6, 7, 8, 9, 1...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 17

Group: 5

Verdict:

input
250 250 200000
*..*.*****.*********.****.****...

correct output
3
3
2
2
2
...

user output
{1: [0, 1, 2, 17, 24, 25, 31, ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 18

Group: 5

Verdict:

input
250 250 200000
*********.**********.******.**...

correct output
3
3
3
3
3
...

user output
{9: [0, 1, 5, 6, 7, 12, 18, 20...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 19

Group: 5

Verdict:

input
250 250 200000
.*****************************...

correct output
104
422
145
93
65
...

user output
{0: [0], 249: [0, 249], 1: [1,...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 20

Group: 5

Verdict:

input
250 250 200000
..****************************...

correct output
57
155
38
65
98
...

user output
{0: [0, 1], 1: [0, 1], 248: [0...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 21

Group: 5

Verdict:

input
250 250 200000
.*****************************...

correct output
498
498
498
498
498
...

user output
{0: [0, 1], 1: [1, 2], 2: [2, ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 22

Group: 1, 2, 3, 4, 5

Verdict:

input
10 1 10
*
*
.
*
...

correct output
0
1
1
0
0
...

user output
{0: [2, 5, 9]} {2: [0], 5: [0]...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 23

Group: 1, 2, 3, 4, 5

Verdict:

input
1 10 10
........*.
1 7 1 10
1 4 1 7
1 5 1 1
...

correct output
1
1
1
1
1
...

user output
{0: [0], 1: [0], 2: [0], 3: [0...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 24

Group: 5

Verdict:

input
250 1 200000
*
.
*
.
...

correct output
1
1
1
1
1
...

user output
{0: [1, 3, 4, 7, 9, 13, 14, 17...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 25

Group: 5

Verdict:

input
1 250 200000
*.*.*...*.*.**.***..**.*.*..**...

correct output
1
1
1
1
1
...

user output
{1: [0], 3: [0], 5: [0], 6: [0...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 26

Group: 5

Verdict:

input
250 250 200000
.................................

correct output
2
2
2
2
2
...

user output
{0: [0, 1, 2, 3, 4, 5, 6, 7, 8...

Error:
Traceback (most recent call last):
  File "input/code.py", line 61, in <module>
    closest = min(visible_points, key=visible_points.get)
ValueError: arg is an empty sequence

Test 27

Group: 5

Verdict:

input
250 250 200000
******************************...

correct output
0
0
0
0
0
...

user output
{249: [249]} {249: [249]}
{(249, 249): 0}
0
0
0
...

Feedback: Output is longer than expected