Submission details
Task:Robotti
Sender:Username*
Submission time:2026-01-17 14:15:27 +0200
Language:Python3 (CPython3)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#2ACCEPTED0.02 sdetails
#3ACCEPTED0.02 sdetails
#4ACCEPTED0.02 sdetails
#5ACCEPTED0.02 sdetails
#6ACCEPTED0.77 sdetails

Code

n = int(input())

steps = 0

grid = [[""]]*n

#print(grid)

for i in range(n):
    grid[i]=list(input())

loc = (0,-1)
move = (0,1)
s = True

#In addition, when the robot leaves a cell, the turn is inversed.

while True:
    loc = (loc[0]+move[0], loc[1]+move[1])
    steps += 1
    if(loc[0] < 0 or loc[1] < 0 or loc[0] > n-1 or loc[1] > n-1):
        break
    curCell = grid[loc[1]][loc[0]]
    if (curCell == "/"):
        move = (-move[1], -move[0])
        grid[loc[1]][loc[0]] = "\\"
    elif (curCell == "\\"):
        move = (move[1], move[0])
        grid[loc[1]][loc[0]] = "/"
    i = 0

print(steps-1)

Test details

Test 1 (public)

Verdict: ACCEPTED

input
3
./\
\./
\/.

correct output
13

user output
13

Test 2

Verdict: ACCEPTED

input
1
.

correct output
1

user output
1

Test 3

Verdict: ACCEPTED

input
5
./\/\
.....
.....
.....
...

correct output
25

user output
25

Test 4

Verdict: ACCEPTED

input
5
\\/\\
/\/\/
\\/\\
/\/\/
...

correct output
37

user output
37

Test 5

Verdict: ACCEPTED

input
20
\\/\/\/\\./\\.\/\/\.
/\\\\\\/\\\\\\\\\\\.
\\\\\\\\\\\\\\\\\\\\
/\\\\\\\\\\\\\.\\\\\
...

correct output
2519

user output
2519

Test 6

Verdict: ACCEPTED

input
20
\\..................
.\\..............\\.
..\\............\\..
...\\..........\\...
...

correct output
917489

user output
917489