Submission details
Task:Hypyt
Sender:yoonseoj
Submission time:2025-11-07 22:15:49 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#10.04 s1, 2, 3, 4, 5details
#20.05 s1, 2, 3, 4, 5details
#30.05 s1, 2, 3, 4, 5details
#40.04 s1, 2, 3, 4, 5details
#50.04 s1, 2, 3, 4, 5details
#60.32 s2, 5details
#70.25 s2, 5details
#80.18 s2, 5details
#90.39 s3, 4, 5details
#100.39 s3, 4, 5details
#110.38 s3, 4, 5details
#120.40 s4, 5details
#130.41 s4, 5details
#140.40 s4, 5details
#150.69 s5details
#160.61 s5details
#170.55 s5details
#180.50 s5details
#190.48 s5details
#200.48 s5details
#210.40 s5details
#220.04 s1, 2, 3, 4, 5details
#230.04 s1, 2, 3, 4, 5details
#240.40 s5details
#250.37 s5details
#260.74 s5details
#270.33 s5details

Code

n, m, k = (int(x) for x in input().split())
lis = []
t =True
while t:
    if n==1:
        t= False
    n=n-1
    a = input()
    lis.append(a)

n = len(lis)

mn = n + m
nod = [[] for _ in range(mn)]
#nod o se koo tal juttu
for i in range(n):
    for j in range(m):
        if lis[i][j] == ".":
            nod[i].append(n + j)

            nod[n + j].append(i)
print(nod)

dis = [[-1] *mn for _ in range(mn)]
e=0
for s in range(mn):
    dis[s][s] = 0
    q = [s]
    e = 0
    while e < len(q):
        u = q[e]
        e += 1
        du = dis[s][u]
        for w in nod[u]:
            if dis[s][w] == -1:
                q.append(w)
                dis[s][w] = du + 1
print(dis)

def saat_jumps(sour, des):
    
    if sour == des:
        return 0

    r2, c2 = des
    r1, c1 = sour
    a = r1
    a2 = n + c1
    b1 = r2
    b2 = n + c2
    bost = -1
    for i in (a, a2):
        for j in (b1, b2):
            d = dis[i][j]

            if d != -1:
                val = d + 1
                if bost == -1 or val < bost:
                    bost = val
    return bost

pr=[]
for b in range(0,k):
    n1, m2, k3, k4 = (int(x) for x in input().split())
    h= (n1-1, m2-1)
    g= (k3-1, k4-1)
    t = saat_jumps(h, g)
    pr.append(t)
for o in pr:
    print(o)

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
[[4, 6], [5, 6, 7], [9], [5, 6...

Feedback: Output is longer than expected

Test 2

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
1
2
1
2
2
...

user output
[[10, 11, 12, 13, 14, 15, 16, ...

Feedback: Output is longer than expected

Test 3

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
1
2
2
1
2
...

user output
[[11, 12, 13, 17], [15, 17, 18...

Feedback: Output is longer than expected

Test 4

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
3
4
2
3
4
...

user output
[[13, 15], [], [11], [10, 12, ...

Feedback: Output is longer than expected

Test 5

Group: 1, 2, 3, 4, 5

Verdict:

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

correct output
7

user output
[[10, 15], [12, 15, 16], [], [...

Feedback: Output is longer than expected

Test 6

Group: 2, 5

Verdict:

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

correct output
2
3
3
2
2
...

user output
[[250, 252, 253, 254, 256, 257...

Feedback: Output is longer than expected

Test 7

Group: 2, 5

Verdict:

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

correct output
2
2
2
2
3
...

user output
[[250, 251, 252, 254, 255, 256...

Feedback: Output is longer than expected

Test 8

Group: 2, 5

Verdict:

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

correct output
2
3
3
3
3
...

user output
[[252, 253, 256, 257, 262, 267...

Feedback: Output is longer than expected

Test 9

Group: 3, 4, 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[[40, 41, 42, 44, 47, 49, 50, ...

Feedback: Output is longer than expected

Test 10

Group: 3, 4, 5

Verdict:

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

correct output
2
1
3
2
2
...

user output
[[42, 45, 46, 48, 50, 52, 59, ...

Feedback: Output is longer than expected

Test 11

Group: 3, 4, 5

Verdict:

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

correct output
3
3
3
3
3
...

user output
[[40, 42, 44, 47, 53, 57, 59, ...

Feedback: Output is longer than expected

Test 12

Group: 4, 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[[81, 82, 83, 84, 87, 91, 92, ...

Feedback: Output is longer than expected

Test 13

Group: 4, 5

Verdict:

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

correct output
3
2
2
3
2
...

user output
[[80, 84, 86, 87, 89, 93, 94, ...

Feedback: Output is longer than expected

Test 14

Group: 4, 5

Verdict:

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

correct output
2
3
1
2
2
...

user output
[[87, 93, 95, 96, 98, 99, 104,...

Feedback: Output is longer than expected

Test 15

Group: 5

Verdict:

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

correct output
3
2
2
2
2
...

user output
[[251, 252, 253, 254, 256, 257...

Feedback: Output is longer than expected

Test 16

Group: 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[[250, 251, 253, 254, 255, 256...

Feedback: Output is longer than expected

Test 17

Group: 5

Verdict:

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

correct output
3
3
2
2
2
...

user output
[[251, 252, 254, 260, 270, 275...

Feedback: Output is longer than expected

Test 18

Group: 5

Verdict:

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

correct output
3
3
3
3
3
...

user output
[[259, 270, 277, 290, 297, 300...

Feedback: Output is longer than expected

Test 19

Group: 5

Verdict:

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

correct output
104
422
145
93
65
...

user output
[[250, 499], [251, 498], [252,...

Feedback: Output is longer than expected

Test 20

Group: 5

Verdict:

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

correct output
57
155
38
65
98
...

user output
[[250, 251, 498, 499], [250, 2...

Feedback: Output is longer than expected

Test 21

Group: 5

Verdict:

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

correct output
498
498
498
498
498
...

user output
[[250], [250, 251], [251, 252]...

Feedback: Output is longer than expected

Test 22

Group: 1, 2, 3, 4, 5

Verdict:

input
10 1 10
*
*
.
*
...

correct output
0
1
1
0
0
...

user output
[[], [], [10], [], [], [10], [...

Feedback: Output is longer than expected

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
[[1, 2, 3, 4, 5, 6, 7, 8, 10],...

Feedback: Output is longer than expected

Test 24

Group: 5

Verdict:

input
250 1 200000
*
.
*
.
...

correct output
1
1
1
1
1
...

user output
[[], [250], [], [250], [250], ...

Feedback: Output is longer than expected

Test 25

Group: 5

Verdict:

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

correct output
1
1
1
1
1
...

user output
[[2, 4, 6, 7, 8, 10, 12, 15, 1...

Feedback: Output is longer than expected

Test 26

Group: 5

Verdict:

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

correct output
2
2
2
2
2
...

user output
[[250, 251, 252, 253, 254, 255...

Feedback: Output is longer than expected

Test 27

Group: 5

Verdict:

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

correct output
0
0
0
0
0
...

user output
[[], [], [], [], [], [], [], [...

Feedback: Output is longer than expected