Submission details
Task:Hypyt
Sender:Emerald0X2
Submission time:2025-10-31 19:21:03 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#10.08 s1, 2, 3, 4, 5details
#2--1, 2, 3, 4, 5details
#30.08 s1, 2, 3, 4, 5details
#4--1, 2, 3, 4, 5details
#50.08 s1, 2, 3, 4, 5details
#6--2, 5details
#70.11 s2, 5details
#80.11 s2, 5details
#9--3, 4, 5details
#10--3, 4, 5details
#110.09 s3, 4, 5details
#12--4, 5details
#13--4, 5details
#140.09 s4, 5details
#15--5details
#160.11 s5details
#170.11 s5details
#180.10 s5details
#19--5details
#200.10 s5details
#21--5details
#22--1, 2, 3, 4, 5details
#230.09 s1, 2, 3, 4, 5details
#24--5details
#250.08 s5details
#260.12 s5details
#270.61 s5details

Code

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

y = int(y)
x = int(x)
questions = int(questions)

area = []
safe = []

for i in range(y):
    area.append(list(input()))
    
for i in range(y):
    for j in range(x):
        if area[i][j] == ".":
            safe.append([i,j])

print(area)

for i in range(questions):
    y1,x1,y2,x2 = input().split()
    y1 = int(y1)
    x1 = int(x1)
    y2 = int(y2)
    x2 = int(x2)

    not_possible = False

    cur_pos = [y2,x2]
    target_pos = [y1, x1]

    path = []
    x_diff = x1-x2
    y_diff = y1-y2
    while cur_pos != target_pos:
        if(abs(y_diff) > abs(x_diff)):
            for pos in safe:
                if pos[0] == cur_pos[0] and pos != cur_pos:
                    path.append(cur_pos)
                    cur_pos == pos
                    break

        elif(abs(x_diff) > abs(y_diff)):
            if pos[1] == cur_pos[1] and pos != cur_pos:
                    path.append(cur_pos)
                    cur_pos == pos
                    break

    if (not_possible):
        print(-1)
    else:
        print(len(path))
    

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
[['.', '*', '.', '*', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 2

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
1
2
1
2
2
...

user output
(empty)

Test 3

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
1
2
2
1
2
...

user output
[['*', '.', '.', '.', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 4

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
3
4
2
3
4
...

user output
(empty)

Test 5

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
7

user output
[['.', '*', '*', '*', '*', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 6

Group: 2, 5

Verdict:

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

correct output
2
3
3
2
2
...

user output
(empty)

Test 7

Group: 2, 5

Verdict:

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

correct output
2
2
2
2
3
...

user output
[['.', '.', '.', '*', '.', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 8

Group: 2, 5

Verdict:

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

correct output
2
3
3
3
3
...

user output
[['*', '*', '.', '.', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 9

Group: 3, 4, 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
(empty)

Test 10

Group: 3, 4, 5

Verdict:

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

correct output
2
1
3
2
2
...

user output
(empty)

Test 11

Group: 3, 4, 5

Verdict:

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

correct output
3
3
3
3
3
...

user output
[['.', '*', '.', '*', '.', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 12

Group: 4, 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
(empty)

Test 13

Group: 4, 5

Verdict:

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

correct output
3
2
2
3
2
...

user output
(empty)

Test 14

Group: 4, 5

Verdict:

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

correct output
2
3
1
2
2
...

user output
[['*', '*', '*', '*', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 15

Group: 5

Verdict:

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

correct output
3
2
2
2
2
...

user output
(empty)

Test 16

Group: 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[['.', '.', '*', '.', '.', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 17

Group: 5

Verdict:

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

correct output
3
3
2
2
2
...

user output
[['*', '.', '.', '*', '.', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 18

Group: 5

Verdict:

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

correct output
3
3
3
3
3
...

user output
[['*', '*', '*', '*', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 19

Group: 5

Verdict:

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

correct output
104
422
145
93
65
...

user output
(empty)

Test 20

Group: 5

Verdict:

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

correct output
57
155
38
65
98
...

user output
[['.', '.', '*', '*', '*', '*'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 21

Group: 5

Verdict:

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

correct output
498
498
498
498
498
...

user output
(empty)

Test 22

Group: 1, 2, 3, 4, 5

Verdict:

input
10 1 10
*
*
.
*
...

correct output
0
1
1
0
0
...

user output
(empty)

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
[['.', '.', '.', '.', '.', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 24

Group: 5

Verdict:

input
250 1 200000
*
.
*
.
...

correct output
1
1
1
1
1
...

user output
(empty)

Test 25

Group: 5

Verdict:

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

correct output
1
1
1
1
1
...

user output
[['*', '.', '*', '.', '*', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 26

Group: 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[['.', '.', '.', '.', '.', '.'...

Error:
Traceback (most recent call last):
  File "input/code.py", line 44, in <module>
    if pos[1] == cur_pos[1] and pos != cur_pos:
NameError: name 'pos' is not defined. Did you mean: pow?

Test 27

Group: 5

Verdict:

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

correct output
0
0
0
0
0
...

user output
[['*', '*', '*', '*', '*', '*'...

Feedback: Output is longer than expected