Task: | Sokkelo |
Sender: | okkokko |
Submission time: | 2022-01-22 16:40:15 +0200 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1, 2 | details |
#2 | RUNTIME ERROR | 0.06 s | 1, 2 | details |
#3 | RUNTIME ERROR | 0.06 s | 1, 2 | details |
#4 | WRONG ANSWER | 0.11 s | 2 | details |
#5 | WRONG ANSWER | 0.09 s | 2 | details |
#6 | WRONG ANSWER | 0.09 s | 2 | details |
#7 | RUNTIME ERROR | 0.06 s | 1, 2 | details |
#8 | WRONG ANSWER | 0.09 s | 2 | details |
#9 | RUNTIME ERROR | 0.47 s | 2 | details |
#10 | RUNTIME ERROR | 0.07 s | 1, 2 | details |
#11 | WRONG ANSWER | 0.10 s | 2 | details |
#12 | RUNTIME ERROR | 0.06 s | 1, 2 | details |
#13 | RUNTIME ERROR | 0.14 s | 2 | details |
#14 | RUNTIME ERROR | 0.06 s | 1, 2 | details |
#15 | RUNTIME ERROR | 0.11 s | 2 | details |
#16 | ACCEPTED | 0.05 s | 2 | details |
#17 | ACCEPTED | 0.07 s | 2 | details |
Code
from itertools import product def I(): return map(int, input().split()) def main(): n, m = I() # y,x sokStr = [input() for _ in range(n)] def findPerson(person): for i in range(n): a = sokStr[i].find(person) if a != -1: return a, i Ax, Ay = findPerson("A") Bx, By = findPerson("B") Apath = [] Bpath = [] sokkelo = [[1 if i == "#" else 0 for i in s] for s in sokStr] # wall is 1, A is 2, B is 3 def mark(x, y, side): if not sokkelo[y][x]: sokkelo[y][x] = side (Apath if side == 2 else Bpath).append((y, x)) for a in (1, -1): if 1 <= x + a < m - 1: # jokainen reunaruutu on seinää mark(x + a, y, side) if 1 <= y + a < n - 1: mark(x, y + a, side) def markA(x, y): if not sokkelo[y][x]: sokkelo[y][x] = 2 Apath.append((y, x)) for a in (1, -1): if 1 <= x + a < m - 1: # jokainen reunaruutu on seinää markA(x + a, y) if 1 <= y + a < n - 1: markA(x, y + a) def markB(x, y): if not sokkelo[y][x]: sokkelo[y][x] = 3 Apath.append((y, x)) for a in (1, -1): if 1 <= x + a < m - 1: # jokainen reunaruutu on seinää markB(x + a, y) if 1 <= y + a < n - 1: markB(x, y + a) try: markA(Ax, Ay) # Virhe on täällä, ei ole IndexError except: print(0) return if sokkelo[By][Bx] == 2: print(1) return markB(Bx, By) def manhattan(a, b): return abs(a[0] - b[0]) + abs(a[1] - b[1]) print(min(manhattan(a, b) for a, b in product(Apath, Bpath))) if __name__ == "__main__": main()
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
20 20 #################### #A.................# #..................# #..................# ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### #A.................# #..................# #..................# ... |
correct output |
---|
2 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 3
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### #A.................# #..................# #..................# ... |
correct output |
---|
9 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 4
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 ##############################... |
correct output |
---|
1 |
user output |
---|
0 |
Test 5
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 ##############################... |
correct output |
---|
2 |
user output |
---|
0 |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 ##############################... |
correct output |
---|
335 |
user output |
---|
0 |
Test 7
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### #####.############## ###.....############ ##.......########### ... |
correct output |
---|
10 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 ##############################... |
correct output |
---|
436 |
user output |
---|
0 |
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
1000 1000 ##############################... |
correct output |
---|
2 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 10
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### #B................## #################.## #################.## ... |
correct output |
---|
2 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 11
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 ##############################... |
correct output |
---|
2 |
user output |
---|
0 |
Test 12
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### ##########A######### ##########.######### ##########.######### ... |
correct output |
---|
2 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 13
Group: 2
Verdict: RUNTIME ERROR
input |
---|
1000 1000 ##############################... |
correct output |
---|
2 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 14
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
20 20 #################### ##########A######### ##########.######### ##########.######### ... |
correct output |
---|
12 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 15
Group: 2
Verdict: RUNTIME ERROR
input |
---|
1000 1000 ##############################... |
correct output |
---|
502 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 69, in <module> main()...
Test 16
Group: 2
Verdict: ACCEPTED
input |
---|
3 1000 ##############################... |
correct output |
---|
1 |
user output |
---|
1 |
Test 17
Group: 2
Verdict: ACCEPTED
input |
---|
1000 3 ### #A# #.# #.# ... |
correct output |
---|
1 |
user output |
---|
1 |